@engagently/types 2.6.1 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import type { defaultResources } from '../../i18n/i18n';
2
2
  import type { AvailableThemes, ColorSchemesConfig } from '../../ui/themes/_types';
3
- import type { PaletteConfig } from '../../ui/themes/config';
3
+ import type { PaletteConfig, ThemeSettings } from '../../ui/themes/config';
4
4
  import type { CombinedError, Operation } from '@urql/preact';
5
5
  import type { EgyEntities, MessageEvents } from './WidgetDefinitions';
6
6
  import type { DsmFeatureName, PlmFeatureName } from '../lib/api/enums';
@@ -23,6 +23,7 @@ export interface EngageConfig {
23
23
  strategy?: string;
24
24
  palette?: PaletteConfig;
25
25
  theme?: `${AvailableThemes}`;
26
+ themeSettings?: Partial<ThemeSettings>;
26
27
  defaultLanguage?: string;
27
28
  translations?: Translations;
28
29
  dev?: boolean;
@@ -46,6 +46,8 @@ export declare const defaultResources: {
46
46
  "load-more": string;
47
47
  "load-newer-comments": string;
48
48
  "load-older-comments": string;
49
+ "load-newer-replies": string;
50
+ "load-older-replies": string;
49
51
  options: string;
50
52
  reply: string;
51
53
  "reply-do": string;
@@ -121,8 +123,11 @@ export declare const defaultResources: {
121
123
  };
122
124
  reactions: {
123
125
  REACTION1: string;
126
+ REACTION1_zero: string;
124
127
  REACTION2: string;
128
+ REACTION2_zero: string;
125
129
  REACTION3: string;
130
+ REACTION3_zero: string;
126
131
  };
127
132
  "reply-as": string;
128
133
  "reply-to": string;
@@ -279,6 +284,8 @@ export declare const defaultResources: {
279
284
  "load-more": string;
280
285
  "load-newer-comments": string;
281
286
  "load-older-comments": string;
287
+ "load-newer-replies": string;
288
+ "load-older-replies": string;
282
289
  options: string;
283
290
  reply: string;
284
291
  "reply-do": string;
@@ -354,8 +361,11 @@ export declare const defaultResources: {
354
361
  };
355
362
  reactions: {
356
363
  REACTION1: string;
364
+ REACTION1_zero: string;
357
365
  REACTION2: string;
366
+ REACTION2_zero: string;
358
367
  REACTION3: string;
368
+ REACTION3_zero: string;
359
369
  };
360
370
  "reply-as": string;
361
371
  "reply-to": string;
@@ -0,0 +1,40 @@
1
+ import type emptyTheme from '../../themes/unstyled';
2
+ import type { ButtonSizes, ButtonVariants, ComponentColorScheme, ThemeAnimations, ThemeBreakpoints, ThemeLevels, ThemePalette, ThemeShadows, ThemeShape, ThemeSpacing, ThemeTypography } from '../../themes/config';
3
+ import type { ColorSchemesConfig } from '../../themes/_types';
4
+ /**
5
+ * Theme styles are custom styles that are different depending on the chosen
6
+ * theme. For example in theme-a the button could have a drop shadow, whereas
7
+ * in theme-b the button is flat.
8
+ */
9
+ export type ThemeStyles = typeof emptyTheme;
10
+ /**
11
+ * Theme settings are general options to control the look and feel of the
12
+ * application. For example the avatar size, or the line thickness.
13
+ * This should allow for easy customization without having to change a bunch
14
+ * of styles.
15
+ */
16
+ export type ThemeSettings = {
17
+ avatarSize: number;
18
+ buttonDiscussionFocusColor?: ComponentColorScheme;
19
+ buttonDiscussionFocusVariant: ButtonVariants;
20
+ buttonRepliesColor?: ComponentColorScheme;
21
+ buttonRepliesVariant: ButtonVariants;
22
+ lineThickness: number;
23
+ viewControlTabSize?: ButtonSizes;
24
+ };
25
+ /**
26
+ * Theme values is where colors, spacing and typography is defined, and can
27
+ * be customized by the user. The palette will change based on the mode.
28
+ */
29
+ export type ThemeValues = {
30
+ animation: ThemeAnimations;
31
+ breakpoints: ThemeBreakpoints;
32
+ levels: ThemeLevels;
33
+ mode: `${ColorSchemesConfig.light}` | `${ColorSchemesConfig.dark}`;
34
+ palette: ThemePalette;
35
+ settings: ThemeSettings;
36
+ shadows: ThemeShadows;
37
+ shape: ThemeShape;
38
+ spacing: ThemeSpacing;
39
+ typography: ThemeTypography;
40
+ };
@@ -0,0 +1,22 @@
1
+ import type { CSSObject } from 'tss-react';
2
+ export type AnimationStyles = {
3
+ enter: CSSObject;
4
+ enterTo: CSSObject;
5
+ enterFrom: CSSObject;
6
+ leave: CSSObject;
7
+ leaveTo: CSSObject;
8
+ leaveFrom: CSSObject;
9
+ };
10
+ export type ThemeAnimations = {
11
+ durations: {
12
+ fast: string;
13
+ slow: string;
14
+ };
15
+ effects: {
16
+ bounce: string;
17
+ flash: (startBgColor: string, endBgColor: string) => string;
18
+ pulse: string;
19
+ spin: string;
20
+ };
21
+ };
22
+ export declare const animation: ThemeAnimations;
@@ -0,0 +1,4 @@
1
+ export type BreakpointNames = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
2
+ export declare const Breakpoints: Record<BreakpointNames, number>;
3
+ export type ThemeBreakpoints = Record<BreakpointNames, string>;
4
+ export declare const breakpoints: ThemeBreakpoints;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * SHARED ACROSS COMPONENTS
3
+ */
4
+ export declare const COMPONENT_COLOR_SCHEME: readonly ["primary", "secondary", "error", "warning", "info", "success"];
5
+ export type ComponentColorScheme = (typeof COMPONENT_COLOR_SCHEME)[number];
6
+ export declare const TYPOGRAPHY_COLOR_SCHEME: readonly ["primary", "secondary", "hint"];
7
+ export type TypographyColorScheme = (typeof TYPOGRAPHY_COLOR_SCHEME)[number];
8
+ /**
9
+ * INDIVIDUAL COMPONENT VARIATIONS
10
+ */
11
+ /** Button */
12
+ export declare const BUTTON_VARIANTS: readonly ["filled", "outlined", "ghost", "link"];
13
+ export declare const BUTTON_SIZES: readonly ["default", "compact", "large"];
14
+ export declare const ICON_BUTTON_VARIANTS: readonly ["filled", "outlined", "ghost"];
15
+ export type ButtonVariants = (typeof BUTTON_VARIANTS)[number];
16
+ export type ButtonSizes = (typeof BUTTON_SIZES)[number];
17
+ export type IconButtonVariants = (typeof ICON_BUTTON_VARIANTS)[number];
18
+ /** Chip */
19
+ export declare const CHIP_VARIANTS: readonly ["filled", "outlined"];
20
+ export type ChipVariants = (typeof CHIP_VARIANTS)[number];
21
+ /** Switch */
22
+ export declare const SWITCH_SIZES: readonly ["default", "compact"];
23
+ export declare const SWITCH_LABEL_POSITIONS: readonly ["left", "right"];
24
+ export type SwitchSizes = (typeof SWITCH_SIZES)[number];
25
+ export type SwitchLabelPositions = (typeof SWITCH_LABEL_POSITIONS)[number];
26
+ /** Typography */
27
+ export declare const TYPOGRAPHY_VARIANTS: readonly ["p", "h1", "h2", "h3", "h4", "h5", "span", "div"];
28
+ export type TypographyVariants = (typeof TYPOGRAPHY_VARIANTS)[number];
@@ -0,0 +1,10 @@
1
+ export * from './_types';
2
+ export * from './animation';
3
+ export * from './breakpoints';
4
+ export * from './components';
5
+ export * from './levels';
6
+ export * from './palette';
7
+ export * from './shadows';
8
+ export * from './shape';
9
+ export * from './spacing';
10
+ export * from './typography';
@@ -0,0 +1,9 @@
1
+ export type ThemeLevels = {
2
+ bottom: number;
3
+ 1: number;
4
+ 2: number;
5
+ 3: number;
6
+ top: number;
7
+ };
8
+ declare const levels: ThemeLevels;
9
+ export { levels };
@@ -56,5 +56,4 @@ export type PaletteConfig = {
56
56
  declare const generateDefaultPalette: () => Omit<ThemePalette, 'background' | 'text' | 'mode' | 'elements' | 'default'>;
57
57
  declare const generatePaletteLight: () => ThemePalette;
58
58
  declare const generatePaletteDark: () => ThemePalette;
59
- declare const mergePalette: (p1: ThemePalette, p2?: DeepPartial<ThemePalette>) => ThemePalette;
60
- export { generateDefaultPalette, generatePaletteDark, generatePaletteLight, mergePalette, };
59
+ export { generateDefaultPalette, generatePaletteDark, generatePaletteLight };
@@ -0,0 +1,14 @@
1
+ export type ThemeShadows = {
2
+ 0: string;
3
+ 1: string;
4
+ 2: string;
5
+ 3: string;
6
+ 4: string;
7
+ 5: string;
8
+ 6: string;
9
+ 7: string;
10
+ 8: string;
11
+ 9: string;
12
+ };
13
+ declare const shadows: ThemeShadows;
14
+ export { shadows };
@@ -0,0 +1,5 @@
1
+ export type ThemeShape = {
2
+ borderRadius: number;
3
+ };
4
+ declare const shape: ThemeShape;
5
+ export { shape };
@@ -0,0 +1,6 @@
1
+ type IsNumberOrString<T> = T extends undefined ? string : number;
2
+ export type ThemeSpacing = typeof spacing;
3
+ declare const spacing: <T extends true | undefined = undefined>(space: number, options?: {
4
+ asNumber?: T | undefined;
5
+ } | undefined) => IsNumberOrString<T>;
6
+ export { spacing };
@@ -0,0 +1,20 @@
1
+ type Typography = {
2
+ fontSize: string;
3
+ fontWeight: string;
4
+ };
5
+ export type ThemeTypography = {
6
+ alert: Typography;
7
+ body: Typography;
8
+ button: Typography;
9
+ caption: Typography;
10
+ chip: Typography;
11
+ fontFamily: string;
12
+ h1: Typography;
13
+ h2: Typography;
14
+ h3: Typography;
15
+ h4: Typography;
16
+ h5: Typography;
17
+ paragraph: Typography;
18
+ };
19
+ declare const typography: ThemeTypography;
20
+ export { typography };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@engagently/types",
3
- "version": "2.6.1",
3
+ "version": "2.7.1",
4
4
  "main": "./index.ts",
5
5
  "types": "dist/types/engagently.d.ts",
6
6
  "files": [