@ssa-ui-kit/core 3.20.1 → 3.20.3

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.
@@ -0,0 +1,113 @@
1
+ import { SerializedStyles, Theme } from '@emotion/react';
2
+ /**
3
+ * Shared skin for floating surfaces (Tooltip, Popover).
4
+ *
5
+ * Tooltip and Popover stay separate components on purpose — they have
6
+ * different roles, interactions and focus behavior — but they render the same
7
+ * surface, so the visual tokens live here instead of being duplicated (and
8
+ * drifting) in each component's own styles.
9
+ *
10
+ * The two deliberately disagree on what an *unset* surface means, because they
11
+ * started from different places:
12
+ * - Tooltip has always drawn a surface of its own, so it defaults to
13
+ * `color: 'grey'` and `hasShadow: true`.
14
+ * - Popover has always been a bare positioned container whose content brings
15
+ * its own surface, so `color` is unset by default and `hasShadow` follows it
16
+ * (`Boolean(color)`) — leaving every popover written before these props
17
+ * existed rendering exactly as it did.
18
+ *
19
+ * Everything below the defaults — the tokens themselves — is identical for
20
+ * both.
21
+ */
22
+ /**
23
+ * Color scheme of a floating surface — mirrors the `Color` dimension of the
24
+ * design.
25
+ * - `grey`: light grey surface with dark text
26
+ * - `white`: white surface with dark text — bordered by default
27
+ * - `dark`: dark surface with white text
28
+ * - `nonOpaque`: semi-transparent white surface with dark text
29
+ */
30
+ export type FloatingSurfaceColor = 'grey' | 'white' | 'dark' | 'nonOpaque';
31
+ /** Padding/typography scale of a floating surface. */
32
+ export type FloatingSurfaceSize = 'small' | 'medium' | 'large';
33
+ export declare const small: SerializedStyles;
34
+ export declare const medium: SerializedStyles;
35
+ export declare const large: SerializedStyles;
36
+ export declare const surfaceSizes: Record<FloatingSurfaceSize, SerializedStyles>;
37
+ /** The two colors a surface is built from. */
38
+ interface SurfacePalette {
39
+ /** Surface background — also fills the arrow. */
40
+ background: (theme: Theme) => string | undefined;
41
+ /**
42
+ * Surface text color, as an explicit value.
43
+ *
44
+ * Needed wherever `currentColor`/inheritance can't be relied on — a global
45
+ * `* { color: … }` reset (Storybook ships one, and consumer apps often do
46
+ * too) sets the computed color of every element it matches, including nested
47
+ * SVGs, so `currentColor` there resolves to the reset's value rather than the
48
+ * surface's.
49
+ */
50
+ text: (theme: Theme) => string | undefined;
51
+ }
52
+ /**
53
+ * Single source of truth for the surface colors. The `background`/`text`/`css`
54
+ * lookups below are all derived from it, so a variant can't end up with a
55
+ * background from one map and a text color from another.
56
+ */
57
+ export declare const surfacePalettes: Record<FloatingSurfaceColor, SurfacePalette>;
58
+ export declare const grey: (theme: Theme) => SerializedStyles;
59
+ export declare const white: (theme: Theme) => SerializedStyles;
60
+ export declare const dark: (theme: Theme) => SerializedStyles;
61
+ export declare const nonOpaque: (theme: Theme) => SerializedStyles;
62
+ export declare const surfaceColors: Record<FloatingSurfaceColor, (theme: Theme) => SerializedStyles>;
63
+ /** Background color of a surface — also used to fill its arrow. */
64
+ export declare const surfaceBackgrounds: Record<FloatingSurfaceColor, (theme: Theme) => string | undefined>;
65
+ /** Text color of a surface, as an explicit value. */
66
+ export declare const surfaceTextColors: Record<FloatingSurfaceColor, (theme: Theme) => string | undefined>;
67
+ export declare const border: (theme: Theme) => SerializedStyles;
68
+ export declare const shadow: (theme: Theme) => SerializedStyles;
69
+ export declare const radius: SerializedStyles;
70
+ /**
71
+ * Headline rendered above the surface content.
72
+ *
73
+ * `color` is declared rather than left to plain inheritance: a global
74
+ * `* { color: … }` reset (Storybook ships one, and consumer apps often do too)
75
+ * outranks an inherited value, so the headline would otherwise ignore the
76
+ * surface color.
77
+ */
78
+ export declare const title: SerializedStyles;
79
+ /** Applied to the surface when a title is rendered alongside its content. */
80
+ export declare const withTitle: SerializedStyles;
81
+ /**
82
+ * Whether a border is drawn by default for a given color — only the white
83
+ * surface is outlined in the design, but the two are independent and either
84
+ * default can be overridden.
85
+ */
86
+ export declare const isBorderedByDefault: (color?: FloatingSurfaceColor) => color is "white";
87
+ /** Arrow attributes a consumer may override, e.g. through `arrowProps`. */
88
+ export interface SurfaceArrowOverrides {
89
+ fill?: string;
90
+ stroke?: string;
91
+ strokeWidth?: number;
92
+ }
93
+ export interface SurfaceArrowOptions {
94
+ theme: Theme;
95
+ /**
96
+ * Surface color the arrow is filled from. Unset falls back to
97
+ * {@link FALLBACK_ARROW_SURFACE}, since an unpainted arrow renders black.
98
+ */
99
+ color?: FloatingSurfaceColor;
100
+ /** Whether the surface itself is outlined. */
101
+ hasBorder?: boolean;
102
+ overrides?: SurfaceArrowOverrides;
103
+ }
104
+ /**
105
+ * Resolves a floating arrow's paint from the surface it points out of, so
106
+ * Tooltip and Popover can't drift apart on it.
107
+ *
108
+ * The outline is tied to the surface's own: an arrow is a cut-out of the
109
+ * surface, so a stroke on it only reads correctly when the surface is bordered
110
+ * too. Without a border there is no stroke, whatever `arrowProps` asks for.
111
+ */
112
+ export declare const resolveSurfaceArrowProps: ({ theme, color, hasBorder, overrides, }: SurfaceArrowOptions) => SurfaceArrowOverrides;
113
+ export {};