@fluentui-react-native/theme-types 0.44.4 → 0.44.6

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,51 +0,0 @@
1
- import type { ColorValue } from 'react-native';
2
-
3
- /**
4
- * Base structure of a shadow style, which has x and y offset, blur amount, and color specified
5
- */
6
- export interface ShadowValue {
7
- x: number;
8
- y: number;
9
- blur: number;
10
- color: ColorValue;
11
- }
12
-
13
- /**
14
- * In FluentUI a shadow is specified as having two parts - an ambient shadow and a key shadow.
15
- * The ambient shadow is shading around the entire control
16
- * The key shadow is the offset shadow which gives the control a sense of elevation or distance from the page
17
- */
18
- export interface ShadowToken {
19
- ambient: ShadowValue;
20
- key: ShadowValue;
21
- }
22
-
23
- /**
24
- * Shadows alias tokens as defined by FluentUI v2 design system
25
- */
26
- export interface BaseShadowAliasTokens {
27
- shadow2: ShadowToken;
28
- shadow4: ShadowToken;
29
- shadow8: ShadowToken;
30
- shadow16: ShadowToken;
31
- shadow28: ShadowToken;
32
- shadow64: ShadowToken;
33
- shadow2brand: ShadowToken;
34
- shadow4brand: ShadowToken;
35
- shadow8brand: ShadowToken;
36
- shadow16brand: ShadowToken;
37
- shadow28brand: ShadowToken;
38
- shadow64brand: ShadowToken;
39
- }
40
-
41
- /**
42
- * Shadows on the theme object. This allows for flexibility on entries but retains base alias tokens
43
- */
44
- export type ThemeShadowDefinition = BaseShadowAliasTokens & {
45
- [key: string]: ShadowToken;
46
- };
47
-
48
- /**
49
- * A partially specified shadow definition.
50
- */
51
- export type PartialShadowDefinition = { [P in keyof ThemeShadowDefinition]?: Partial<ThemeShadowDefinition[P]> };
@@ -1,73 +0,0 @@
1
- import type { ColorValue } from 'react-native';
2
-
3
- import type { ThemeColorDefinition } from './Color.types';
4
- import type { OfficePalette } from './palette.types';
5
- import type { PartialShadowDefinition, ThemeShadowDefinition } from './Shadow.types';
6
- import type { Typography, PartialTypography } from './Typography.types';
7
-
8
- type TwoLevelPartial<T> = { [K in keyof T]?: Partial<T[K]> };
9
-
10
- export interface Spacing {
11
- s2: `${number}px`;
12
- s1: `${number}px`;
13
- m?: `${number}px`;
14
- // m is now defined as a v2 type
15
- l1: `${number}px`;
16
- l2: `${number}px`;
17
- }
18
-
19
- /**
20
- * A fully specified theme.
21
- */
22
- export interface Theme {
23
- name?: string;
24
- colors: ThemeColorDefinition;
25
- typography: Typography;
26
- components: {
27
- [key: string]: Record<string, unknown>;
28
- };
29
- shadows: ThemeShadowDefinition;
30
- readonly spacing: Spacing;
31
- host: {
32
- // appearance of the theme, this corresponds to the react-native Appearance library values, though can be overwritten
33
- // dynamic refers to a theme that handles it's own appearance switching, such as one that uses the PlatformColor API
34
- appearance: AppearanceOptions | 'dynamic';
35
-
36
- // Office palette, if running in Office with the native module connected in the theme
37
- palette?: OfficePalette;
38
- colors?: { [key: string]: ColorValue };
39
- };
40
- }
41
-
42
- /**
43
- * Generally a partial theme is comprised of partial versions of the objects within the theme, with the exception of shadow and typography
44
- * which has additional levels of hierarchy
45
- */
46
- export type PartialTheme = Omit<TwoLevelPartial<Theme>, 'shadows' | 'typography' | 'host'> & {
47
- shadows?: PartialShadowDefinition;
48
- typography?: PartialTypography;
49
- host?: TwoLevelPartial<Theme['host']>;
50
- };
51
-
52
- export type AppearanceOptions = 'light' | 'dark' | 'darkElevated' | 'highContrast';
53
-
54
- export interface ThemeOptions {
55
- /**
56
- * Should the baseline colors be light, dark, or use the values from the Appearance API from react-native.
57
- */
58
- appearance?: AppearanceOptions | 'dynamic';
59
-
60
- /**
61
- * Default appearance should the library to request this from native not be available
62
- */
63
- defaultAppearance?: AppearanceOptions;
64
-
65
- /**
66
- * If in a host that supports multiple areas within the app that use different palettes, this specifies the palette name to
67
- * load.
68
- *
69
- * In Office this corresponds to regions like taskpanes, the ribbon, left navigation, and so on, but that concept could be extended
70
- * to any host that wants to support this.
71
- */
72
- paletteName?: string;
73
- }
@@ -1,185 +0,0 @@
1
- import type { TextProps, TextStyle } from 'react-native';
2
-
3
- /**
4
- * A font family designation, made up of one or more font names or groupings
5
- * (comma-separated):
6
- *
7
- * - `Calibri Light`, `Calibri, Times`
8
- * - `Menlo, Monaco`, `Courier New`, `Courier`
9
- * - `Consolas`
10
- *
11
- * The font family expresses an ordered preference of fonts to use, working
12
- * from the first entry to the last. This "fallback" mechanism is necessary
13
- * because the availability of specific fonts varies between native platforms,
14
- * as well as between operating system versions.
15
- */
16
- export type FontFamilyValue = string;
17
-
18
- /**
19
- * A collection of named font families.
20
- *
21
- * The names express the fundamental character of the assigned font family. They
22
- * should be used when defining a theme.
23
- *
24
- * **NOTE:** `primary` and `secondary` are both meant to be assigned a 'normal' family.
25
- */
26
- export interface FontFamilies {
27
- primary: FontFamilyValue;
28
- secondary: FontFamilyValue;
29
- cursive: FontFamilyValue;
30
- monospace: FontFamilyValue;
31
- numeric: FontFamilyValue;
32
- sansSerif: FontFamilyValue;
33
- serif: FontFamilyValue;
34
- }
35
-
36
- /**
37
- * A font family, used when defining a visual element in a theme.
38
- */
39
- export type FontFamily = keyof FontFamilies | FontFamilyValue;
40
-
41
- /**
42
- * A font size value, specified in CSS pixels (px).
43
- */
44
- export type FontSizeValuePoints = number;
45
-
46
- /**
47
- * A collection of named font sizes.
48
- *
49
- * The names express a spectrum of relative sizes. Words are used instead
50
- * of numbers to avoid implying anything about the size value, or its
51
- * relationship to size values near it.
52
- *
53
- * These names should be used when defining a theme.
54
- */
55
- export interface FontSizes {
56
- caption: FontSizeValuePoints;
57
- secondary: FontSizeValuePoints;
58
- body: FontSizeValuePoints;
59
- subheader: FontSizeValuePoints;
60
- header: FontSizeValuePoints;
61
- hero: FontSizeValuePoints;
62
- heroLarge: FontSizeValuePoints;
63
- }
64
-
65
- /**
66
- * A font size, used when defining a visual element in a theme.
67
- */
68
- export type FontSize = keyof FontSizes | FontSizeValuePoints;
69
-
70
- /**
71
- * A font weight value.
72
- *
73
- * Smaller numbers yield a thinner, lighter font. Larger numbers yield a thicker, darker
74
- * font.
75
- */
76
- export type FontWeightValue = TextStyle['fontWeight'];
77
-
78
- /**
79
- * A collection of named font weights.
80
- *
81
- * The names express a spectrum of relative weights. Words are used instead
82
- * of numbers to avoid implying anything about the weight value, or its
83
- * relationship to weight values near it.
84
- *
85
- * These names should be used when defining a theme.
86
- */
87
- export interface FontWeights {
88
- regular: FontWeightValue;
89
- semiBold: FontWeightValue;
90
- }
91
-
92
- /**
93
- * A font weight, used when defining a visual element in a theme.
94
- */
95
- export type FontWeight = keyof FontWeights | FontWeightValue;
96
-
97
- /**
98
- * A font line height value, specified in CSS pixels (px).
99
- */
100
- export type FontLineHeight = number;
101
-
102
- /**
103
- * A font letter spacing value, specified in points on Apple platforms and ems everywhere else.
104
- */
105
- export type FontLetterSpacing = number;
106
-
107
- /**
108
- * On iOS, the Dynamic Type ramp that this variant should conform to.
109
- */
110
- export type FontDynamicTypeRamp = TextProps['dynamicTypeRamp'];
111
-
112
- /**
113
- * A font variant value.
114
- */
115
- export type VariantValue = {
116
- face: FontFamily;
117
- size: FontSize;
118
- weight: FontWeight;
119
- lineHeight?: FontLineHeight;
120
- letterSpacing?: FontLetterSpacing;
121
- dynamicTypeRamp?: FontDynamicTypeRamp;
122
- };
123
-
124
- /**
125
- * A collection of named font variants.
126
- */
127
- export interface Variants {
128
- captionStandard: VariantValue;
129
- secondaryStandard: VariantValue;
130
- secondarySemibold: VariantValue;
131
- bodyStandard: VariantValue;
132
- bodySemibold: VariantValue;
133
- subheaderStandard: VariantValue;
134
- subheaderSemibold: VariantValue;
135
- headerStandard: VariantValue;
136
- headerSemibold: VariantValue;
137
- heroStandard: VariantValue;
138
- heroSemibold: VariantValue;
139
- heroLargeStandard: VariantValue;
140
- heroLargeSemibold: VariantValue;
141
- //v2 variants
142
- caption1?: VariantValue;
143
- caption1Strong?: VariantValue;
144
- caption2?: VariantValue;
145
- body1?: VariantValue;
146
- body1Strong?: VariantValue;
147
- body2?: VariantValue;
148
- body2Strong?: VariantValue;
149
- subtitle1?: VariantValue;
150
- subtitle1Strong?: VariantValue;
151
- subtitle2?: VariantValue;
152
- subtitle2Strong?: VariantValue;
153
- title1?: VariantValue;
154
- title1Strong?: VariantValue;
155
- title2?: VariantValue;
156
- title3?: VariantValue;
157
- largeTitle?: VariantValue;
158
- display?: VariantValue;
159
- }
160
-
161
- /**
162
- * A font variant, used when defining a visual element in a theme.
163
- */
164
- export type Variant = keyof Variants | VariantValue;
165
-
166
- /**
167
- * A collection of typographic (font) information.
168
- *
169
- * When setting a font in a theme, choose a family, size and weight from
170
- * this collection.
171
- */
172
-
173
- export interface TextStyling {
174
- families: FontFamilies;
175
- sizes: FontSizes;
176
- weights: FontWeights;
177
- variants: Variants;
178
- }
179
-
180
- export type Typography = TextStyling;
181
-
182
- /**
183
- * A partially specified typography.
184
- */
185
- export type PartialTypography = { [P in keyof Typography]?: Partial<Typography[P]> };
package/src/context.ts DELETED
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import type { Theme } from './Theme.types';
4
-
5
- export const ThemeContext = React.createContext<Theme>(undefined);
6
- export const useTheme = () => React.useContext(ThemeContext);
@@ -1,257 +0,0 @@
1
- import type { ColorValue } from 'react-native';
2
-
3
- export interface OfficePalette {
4
- /**
5
- * Background Colors
6
- *
7
- * Background color for any region of the user interface.
8
- */
9
- Bkg: ColorValue;
10
- BkgHover: ColorValue;
11
- BkgPressed: ColorValue;
12
- BkgSelected: ColorValue;
13
- BkgSelectionHighlight: ColorValue;
14
- BkgSubtle: ColorValue;
15
-
16
- /**
17
- * Transparent Control Colors
18
- *
19
- * These colors should be used to build controls with a transparent
20
- * background. For example, list items and ribbon buttons.
21
- */
22
- // text
23
- Text: ColorValue;
24
- TextRest: ColorValue;
25
- TextHover: ColorValue;
26
- TextPressed: ColorValue;
27
- TextSelected: ColorValue;
28
- TextDisabled: ColorValue;
29
- TextSelectionHighlight: ColorValue;
30
-
31
- TextSecondary: ColorValue;
32
- TextSecondaryRest: ColorValue;
33
- TextSecondaryHover: ColorValue;
34
- TextSecondaryPressed: ColorValue;
35
- TextSecondarySelected: ColorValue;
36
-
37
- // emphasized text, usually with an accent color
38
- TextEmphasis: ColorValue;
39
- TextEmphasisRest: ColorValue;
40
- TextEmphasisHover: ColorValue;
41
- TextEmphasisPressed: ColorValue;
42
- TextEmphasisSelected: ColorValue;
43
-
44
- // stroke colors (typically borders, outlines or underlines)
45
- StrokeSelectedHover: ColorValue;
46
- StrokeKeyboard: ColorValue;
47
-
48
- // stroke overlay colors (typically borders, outlines or underlines)
49
- StrokeOverRest: ColorValue;
50
- StrokeOverHover: ColorValue;
51
- StrokeOverPressed: ColorValue;
52
- StrokeOverSelectedRest: ColorValue;
53
- StrokeOverSelectedHover: ColorValue;
54
- StrokeOverSelectedPressed: ColorValue;
55
-
56
- /**
57
- * Push Button Controls
58
- *
59
- * Push button controls only. These controls have a non-transparent
60
- * background. Most other controls should not use these colors.
61
- */
62
- // background
63
- BkgCtl: ColorValue;
64
- BkgCtlHover: ColorValue;
65
- BkgCtlPressed: ColorValue;
66
- BkgCtlSelected: ColorValue;
67
- BkgCtlDisabled: ColorValue;
68
-
69
- // text
70
- TextCtl: ColorValue;
71
- TextCtlHover: ColorValue;
72
- TextCtlPressed: ColorValue;
73
- TextCtlSelected: ColorValue;
74
- TextCtlDisabled: ColorValue;
75
-
76
- // stroke colors (typically borders, outlines or underlines)
77
- StrokeCtl: ColorValue;
78
- StrokeCtlHover: ColorValue;
79
- StrokeCtlPressed: ColorValue;
80
- StrokeCtlSelected: ColorValue;
81
- StrokeCtlDisabled: ColorValue;
82
- StrokeCtlKeyboard: ColorValue;
83
-
84
- /**
85
- * Emphasized Push Button Controls
86
- *
87
- * Push button controls only. These controls have a non-transparent
88
- * background. Most other controls should not use these colors.
89
- */
90
- // background
91
- BkgCtlEmphasis: ColorValue;
92
- BkgCtlEmphasisHover: ColorValue;
93
- BkgCtlEmphasisPressed: ColorValue;
94
- BkgCtlEmphasisDisabled: ColorValue;
95
-
96
- // text
97
- TextCtlEmphasis: ColorValue;
98
- TextCtlEmphasisHover: ColorValue;
99
- TextCtlEmphasisPressed: ColorValue;
100
- TextCtlEmphasisDisabled: ColorValue;
101
-
102
- // stroke colors (typically borders, outlines or underlines)
103
- StrokeCtlEmphasis: ColorValue;
104
- StrokeCtlEmphasisHover: ColorValue;
105
- StrokeCtlEmphasisPressed: ColorValue;
106
- StrokeCtlEmphasisDisabled: ColorValue;
107
- StrokeCtlEmphasisKeyboard: ColorValue;
108
-
109
- /**
110
- * Text Controls
111
- *
112
- * Controls which have a background, even in dark themes, such as text box,
113
- * combo box, check box, and radio button.
114
- */
115
- // background
116
- BkgCtlSubtle: ColorValue;
117
- BkgCtlSubtleHover: ColorValue;
118
- BkgCtlSubtlePressed: ColorValue;
119
- BkgCtlSubtleDisabled: ColorValue;
120
-
121
- // text
122
- TextCtlSubtle: ColorValue;
123
- TextCtlSubtleHover: ColorValue;
124
- TextCtlSubtlePressed: ColorValue;
125
- TextCtlSubtleDisabled: ColorValue;
126
-
127
- // stroke colors (typically borders, outlines or underlines)
128
- StrokeCtlSubtle: ColorValue;
129
- StrokeCtlSubtleHover: ColorValue;
130
- StrokeCtlSubtlePressed: ColorValue;
131
- StrokeCtlSubtleDisabled: ColorValue;
132
- StrokeCtlSubtleKeyboard: ColorValue;
133
-
134
- // standalone stroke colors
135
- StrokeOnlyHover: ColorValue;
136
- StrokeOnlyPressed: ColorValue;
137
- StrokeOnlySelected: ColorValue;
138
-
139
- /**
140
- * Hyperlinks
141
- */
142
- TextHyperlink: ColorValue;
143
- TextHyperlinkHover: ColorValue;
144
- TextHyperlinkPressed: ColorValue;
145
-
146
- /**
147
- * Active Text
148
- *
149
- * Text only states, with no background change, such as a pivot control.
150
- */
151
- TextActive: ColorValue;
152
- TextActiveHover: ColorValue;
153
- TextActivePressed: ColorValue;
154
- TextActiveSelected: ColorValue;
155
-
156
- /**
157
- * Errors
158
- */
159
- TextError: ColorValue;
160
- TextErrorHover: ColorValue;
161
- TextErrorPressed: ColorValue;
162
- TextErrorSelected: ColorValue;
163
-
164
- /**
165
- * Accents
166
- *
167
- * Used to emphasize or create boundaries around/within UI.
168
- */
169
-
170
- // Used for general borders
171
- AccentDark: ColorValue;
172
-
173
- // Used for separator lines
174
- AccentLight: ColorValue;
175
-
176
- // Used for accent rectangles and bolder borders
177
- AccentEmphasis: ColorValue;
178
-
179
- // Used for borders that outline the entire UI region
180
- AccentOutline: ColorValue;
181
-
182
- // A subtle tint used to accent a region on top of Bkg
183
- BkgAccentTint: ColorValue;
184
-
185
- // A foreground color used for contrasting text on top of BkgAccentTint
186
- TextAccentTint: ColorValue;
187
-
188
- /**
189
- * Headers
190
- *
191
- * Used for headings on sections of the user interface.
192
- */
193
- BkgHeader: ColorValue;
194
- TextHeader: ColorValue;
195
-
196
- /**
197
- * Thumb toggle colors
198
- */
199
- ThumbToggleSwitchOff: ColorValue;
200
- ThumbToggleSwitchOffHover: ColorValue;
201
- ThumbToggleSwitchOffPressed: ColorValue;
202
- ThumbToggleSwitchOffDisabled: ColorValue;
203
- ThumbToggleSwitchOn: ColorValue;
204
- ThumbToggleSwitchOnHover: ColorValue;
205
- ThumbToggleSwitchOnPressed: ColorValue;
206
- ThumbToggleSwitchOnDisabled: ColorValue;
207
-
208
- /**
209
- * Background values for toggle switches
210
- */
211
- BkgToggleSwitchOff: ColorValue;
212
- BkgToggleSwitchOffHover: ColorValue;
213
- BkgToggleSwitchOffPressed: ColorValue;
214
- BkgToggleSwitchOffDisabled: ColorValue;
215
- BkgToggleSwitchOn: ColorValue;
216
- BkgToggleSwitchOnHover: ColorValue;
217
- BkgToggleSwitchOnPressed: ColorValue;
218
- BkgToggleSwitchOnDisabled: ColorValue;
219
-
220
- /**
221
- * Stroke values for toggle switches
222
- */
223
- StrokeToggleSwitchOff: ColorValue;
224
- StrokeToggleSwitchOffHover: ColorValue;
225
- StrokeToggleSwitchOffPressed: ColorValue;
226
- StrokeToggleSwitchOffDisabled: ColorValue;
227
- StrokeToggleSwitchOn: ColorValue;
228
- StrokeToggleSwitchOnHover: ColorValue;
229
- StrokeToggleSwitchOnPressed: ColorValue;
230
- StrokeToggleSwitchOnDisabled: ColorValue;
231
-
232
- /**
233
- * Slider colors
234
- */
235
- SliderPrimary: ColorValue;
236
- SliderPrimaryHover: ColorValue;
237
- SliderPrimaryPressed: ColorValue;
238
- SliderPrimaryDisabled: ColorValue;
239
- SliderSecondary: ColorValue;
240
- SliderBuffer: ColorValue;
241
- SliderKeyboard: ColorValue;
242
- SliderToolTipBorder: ColorValue;
243
- SliderToolTipLabel: ColorValue;
244
- SliderToolTipBkg: ColorValue;
245
-
246
- /**
247
- * Assorted other colors
248
- */
249
- TextEmphasis2: ColorValue;
250
- BkgCtlSubtleSelected: ColorValue;
251
- TextCtlSubtleSelected: ColorValue;
252
- BkgCtlEmphasisFocus: ColorValue;
253
- BkgCtlSubtleFocus: ColorValue;
254
- BkgCtlSubtleHoverDisabled: ColorValue;
255
- BkgCtlSubtleSelectedDisabled: ColorValue;
256
- TextTextBoxPlaceholder: ColorValue;
257
- }