react-native-ui-lib 8.3.4 → 8.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.
- package/lib/android/build.gradle +3 -3
- package/package.json +1 -1
- package/screenFooter.d.ts +2 -0
- package/screenFooter.js +1 -0
- package/scripts/release/prReleaseNotesCommon.js +2 -1
- package/src/assets/internal/images/bottomGradient.png +0 -0
- package/src/assets/internal/images/bottomGradient@1.5x.png +0 -0
- package/src/assets/internal/images/bottomGradient@2x.png +0 -0
- package/src/assets/internal/images/bottomGradient@3x.png +0 -0
- package/src/assets/internal/images/bottomGradient@4x.png +0 -0
- package/src/assets/internal/images/index.js +3 -0
- package/src/components/floatingButton/floatingButton.api.json +10 -15
- package/src/components/floatingButton/index.d.ts +13 -39
- package/src/components/floatingButton/index.js +57 -167
- package/src/components/screenFooter/index.d.ts +8 -0
- package/src/components/screenFooter/index.js +214 -0
- package/src/components/screenFooter/screenFooter.api.json +250 -0
- package/src/components/screenFooter/types.d.ts +105 -0
- package/src/components/screenFooter/types.js +39 -0
- package/src/components/textField/TextField.driver.new.js +12 -7
- package/src/components/textField/index.js +31 -9
- package/src/hooks/index.d.ts +1 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/useScrollToHide/index.d.ts +24 -0
- package/src/hooks/useScrollToHide/index.js +48 -0
- package/src/incubator/expandableOverlay/index.js +7 -3
- package/src/index.d.ts +1 -0
- package/src/index.js +70 -0
- package/src/style/colors.d.ts +12 -13
- package/src/style/colors.js +40 -39
package/src/index.js
CHANGED
|
@@ -99,6 +99,15 @@ var _exportNames = {
|
|
|
99
99
|
FloatingButton: true,
|
|
100
100
|
FloatingButtonProps: true,
|
|
101
101
|
FloatingButtonLayouts: true,
|
|
102
|
+
ScreenFooter: true,
|
|
103
|
+
ScreenFooterProps: true,
|
|
104
|
+
ScreenFooterLayouts: true,
|
|
105
|
+
ScreenFooterBackgrounds: true,
|
|
106
|
+
FooterAlignment: true,
|
|
107
|
+
HorizontalItemsDistribution: true,
|
|
108
|
+
ItemsFit: true,
|
|
109
|
+
KeyboardBehavior: true,
|
|
110
|
+
ScreenFooterShadow: true,
|
|
102
111
|
Gradient: true,
|
|
103
112
|
GradientProps: true,
|
|
104
113
|
GradientTypes: true,
|
|
@@ -699,6 +708,12 @@ Object.defineProperty(exports, "FloatingButtonProps", {
|
|
|
699
708
|
return _floatingButton().FloatingButtonProps;
|
|
700
709
|
}
|
|
701
710
|
});
|
|
711
|
+
Object.defineProperty(exports, "FooterAlignment", {
|
|
712
|
+
enumerable: true,
|
|
713
|
+
get: function () {
|
|
714
|
+
return _screenFooter().FooterAlignment;
|
|
715
|
+
}
|
|
716
|
+
});
|
|
702
717
|
Object.defineProperty(exports, "ForwardRefInjectedProps", {
|
|
703
718
|
enumerable: true,
|
|
704
719
|
get: function () {
|
|
@@ -790,6 +805,12 @@ Object.defineProperty(exports, "HintProps", {
|
|
|
790
805
|
}
|
|
791
806
|
});
|
|
792
807
|
exports.Hooks = void 0;
|
|
808
|
+
Object.defineProperty(exports, "HorizontalItemsDistribution", {
|
|
809
|
+
enumerable: true,
|
|
810
|
+
get: function () {
|
|
811
|
+
return _screenFooter().HorizontalItemsDistribution;
|
|
812
|
+
}
|
|
813
|
+
});
|
|
793
814
|
Object.defineProperty(exports, "Icon", {
|
|
794
815
|
enumerable: true,
|
|
795
816
|
get: function () {
|
|
@@ -815,6 +836,12 @@ Object.defineProperty(exports, "ImageProps", {
|
|
|
815
836
|
}
|
|
816
837
|
});
|
|
817
838
|
exports.Incubator = void 0;
|
|
839
|
+
Object.defineProperty(exports, "ItemsFit", {
|
|
840
|
+
enumerable: true,
|
|
841
|
+
get: function () {
|
|
842
|
+
return _screenFooter().ItemsFit;
|
|
843
|
+
}
|
|
844
|
+
});
|
|
818
845
|
Object.defineProperty(exports, "KeyboardAwareFlatList", {
|
|
819
846
|
enumerable: true,
|
|
820
847
|
get: function () {
|
|
@@ -827,6 +854,12 @@ Object.defineProperty(exports, "KeyboardAwareScrollView", {
|
|
|
827
854
|
return _KeyboardAwareScrollView().default;
|
|
828
855
|
}
|
|
829
856
|
});
|
|
857
|
+
Object.defineProperty(exports, "KeyboardBehavior", {
|
|
858
|
+
enumerable: true,
|
|
859
|
+
get: function () {
|
|
860
|
+
return _screenFooter().KeyboardBehavior;
|
|
861
|
+
}
|
|
862
|
+
});
|
|
830
863
|
Object.defineProperty(exports, "ListItem", {
|
|
831
864
|
enumerable: true,
|
|
832
865
|
get: function () {
|
|
@@ -1146,6 +1179,36 @@ Object.defineProperty(exports, "RenderCustomModalProps", {
|
|
|
1146
1179
|
return _picker().RenderCustomModalProps;
|
|
1147
1180
|
}
|
|
1148
1181
|
});
|
|
1182
|
+
Object.defineProperty(exports, "ScreenFooter", {
|
|
1183
|
+
enumerable: true,
|
|
1184
|
+
get: function () {
|
|
1185
|
+
return _screenFooter().default;
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
Object.defineProperty(exports, "ScreenFooterBackgrounds", {
|
|
1189
|
+
enumerable: true,
|
|
1190
|
+
get: function () {
|
|
1191
|
+
return _screenFooter().ScreenFooterBackgrounds;
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
Object.defineProperty(exports, "ScreenFooterLayouts", {
|
|
1195
|
+
enumerable: true,
|
|
1196
|
+
get: function () {
|
|
1197
|
+
return _screenFooter().ScreenFooterLayouts;
|
|
1198
|
+
}
|
|
1199
|
+
});
|
|
1200
|
+
Object.defineProperty(exports, "ScreenFooterProps", {
|
|
1201
|
+
enumerable: true,
|
|
1202
|
+
get: function () {
|
|
1203
|
+
return _screenFooter().ScreenFooterProps;
|
|
1204
|
+
}
|
|
1205
|
+
});
|
|
1206
|
+
Object.defineProperty(exports, "ScreenFooterShadow", {
|
|
1207
|
+
enumerable: true,
|
|
1208
|
+
get: function () {
|
|
1209
|
+
return _screenFooter().ScreenFooterShadow;
|
|
1210
|
+
}
|
|
1211
|
+
});
|
|
1149
1212
|
Object.defineProperty(exports, "ScrollBar", {
|
|
1150
1213
|
enumerable: true,
|
|
1151
1214
|
get: function () {
|
|
@@ -1906,6 +1969,13 @@ function _floatingButton() {
|
|
|
1906
1969
|
};
|
|
1907
1970
|
return data;
|
|
1908
1971
|
}
|
|
1972
|
+
function _screenFooter() {
|
|
1973
|
+
const data = _interopRequireWildcard(require("./components/screenFooter"));
|
|
1974
|
+
_screenFooter = function () {
|
|
1975
|
+
return data;
|
|
1976
|
+
};
|
|
1977
|
+
return data;
|
|
1978
|
+
}
|
|
1909
1979
|
function _gradient() {
|
|
1910
1980
|
const data = _interopRequireWildcard(require("./components/gradient"));
|
|
1911
1981
|
_gradient = function () {
|
package/src/style/colors.d.ts
CHANGED
|
@@ -19,9 +19,15 @@ export type GetColorByHexOptions = {
|
|
|
19
19
|
export type GeneratePaletteOptions = {
|
|
20
20
|
/** Whether to adjust the lightness of very light colors (generating darker palette) */
|
|
21
21
|
adjustLightness?: boolean;
|
|
22
|
-
/** Whether to
|
|
22
|
+
/** Whether to apply the saturation curve to unify saturation levels throughout the palette */
|
|
23
23
|
adjustSaturation?: boolean;
|
|
24
|
-
/**
|
|
24
|
+
/** Custom percentage-based saturation curve indexed by distance from the base color.
|
|
25
|
+
* Overrides the default curve when provided. Each value represents the fraction of the base
|
|
26
|
+
* color's saturation to apply at that distance (e.g. [1.0, 0.89, 0.77, ...]).
|
|
27
|
+
* The 'adjustSaturation' option must be true */
|
|
28
|
+
saturationCurve?: number[];
|
|
29
|
+
/** Array of additive saturation adjustments to apply per-index on the palette (from darkest to lightest).
|
|
30
|
+
* When provided, uses legacy per-index saturation logic instead of the default curve.
|
|
25
31
|
* The 'adjustSaturation' option must be true */
|
|
26
32
|
saturationLevels?: number[];
|
|
27
33
|
/** Whether to add two extra dark colors usually used for dark mode (generating a palette of 10 instead of 8 colors) */
|
|
@@ -91,7 +97,6 @@ export declare class Colors {
|
|
|
91
97
|
adjustSaturation: boolean;
|
|
92
98
|
addDarkestTints: boolean;
|
|
93
99
|
avoidReverseOnDark: boolean;
|
|
94
|
-
saturationLevels: undefined;
|
|
95
100
|
};
|
|
96
101
|
generateColorPalette: ((color: string, options?: GeneratePaletteOptions) => string[]) & _.MemoizedFunction;
|
|
97
102
|
private generateDesignTokens;
|
|
@@ -144,7 +149,7 @@ declare const colorObject: Colors & {
|
|
|
144
149
|
green70: string;
|
|
145
150
|
green80: string;
|
|
146
151
|
yellow1: string;
|
|
147
|
-
yellow5: string;
|
|
152
|
+
yellow5: string;
|
|
148
153
|
yellow10: string;
|
|
149
154
|
yellow20: string;
|
|
150
155
|
yellow30: string;
|
|
@@ -212,7 +217,7 @@ declare const colorObject: Colors & {
|
|
|
212
217
|
$backgroundGeneralHeavy: string;
|
|
213
218
|
$backgroundGeneralMedium: string;
|
|
214
219
|
$backgroundGeneralLight: string;
|
|
215
|
-
$backgroundSuccessHeavy: string;
|
|
220
|
+
$backgroundSuccessHeavy: string;
|
|
216
221
|
$backgroundSuccessLight: string;
|
|
217
222
|
$backgroundWarningHeavy: string;
|
|
218
223
|
$backgroundWarningLight: string;
|
|
@@ -258,16 +263,10 @@ declare const colorObject: Colors & {
|
|
|
258
263
|
$outlineNeutralHeavy: string;
|
|
259
264
|
$outlinePrimary: string;
|
|
260
265
|
$outlinePrimaryMedium: string;
|
|
261
|
-
$outlineGeneral: string;
|
|
262
|
-
* Get app's current color scheme
|
|
263
|
-
*/
|
|
266
|
+
$outlineGeneral: string;
|
|
264
267
|
$outlineWarning: string;
|
|
265
268
|
$outlineDanger: string;
|
|
266
|
-
$outlineInverted: string;
|
|
267
|
-
* Set color scheme for app
|
|
268
|
-
* arguments:
|
|
269
|
-
* scheme - color scheme e.g light/dark/default
|
|
270
|
-
*/
|
|
269
|
+
$outlineInverted: string;
|
|
271
270
|
$black: string;
|
|
272
271
|
$white: string;
|
|
273
272
|
};
|
package/src/style/colors.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _map from "lodash/map";
|
|
2
1
|
import _clamp from "lodash/clamp";
|
|
3
2
|
import _toLower from "lodash/toLower";
|
|
4
3
|
import _toUpper from "lodash/toUpper";
|
|
@@ -20,6 +19,9 @@ import DesignTokensDM from "./designTokensDM";
|
|
|
20
19
|
import ColorName from "./colorName";
|
|
21
20
|
import Scheme from "./scheme";
|
|
22
21
|
import LogService from "../services/LogService";
|
|
22
|
+
const SATURATION_CURVE = [1.0, 0.89, 0.77, 0.65, 0.55, 0.47, 0.42, 0.38, 0.34, 0.30];
|
|
23
|
+
const SATURATION_THRESHOLD = 50;
|
|
24
|
+
const SATURATION_FLOOR = 20;
|
|
23
25
|
export class Colors {
|
|
24
26
|
shouldSupportDarkMode = false;
|
|
25
27
|
constructor() {
|
|
@@ -229,15 +231,14 @@ export class Colors {
|
|
|
229
231
|
const start = options?.addDarkestTints && colorLightness > 10 ? -size : 0;
|
|
230
232
|
const end = options?.addDarkestTints && colorLightness > 10 ? undefined : size;
|
|
231
233
|
const sliced = tints.slice(start, end);
|
|
232
|
-
const adjusted = options?.adjustSaturation && adjustSaturation(sliced, color, options
|
|
234
|
+
const adjusted = options?.adjustSaturation && adjustSaturation(sliced, color, options);
|
|
233
235
|
return adjusted || sliced;
|
|
234
236
|
}, generatePaletteCacheResolver);
|
|
235
237
|
defaultPaletteOptions = {
|
|
236
238
|
adjustLightness: true,
|
|
237
239
|
adjustSaturation: true,
|
|
238
240
|
addDarkestTints: false,
|
|
239
|
-
avoidReverseOnDark: false
|
|
240
|
-
saturationLevels: undefined
|
|
241
|
+
avoidReverseOnDark: false
|
|
241
242
|
};
|
|
242
243
|
generateColorPalette = _memoize((color, options) => {
|
|
243
244
|
const _options = {
|
|
@@ -308,46 +309,46 @@ export class Colors {
|
|
|
308
309
|
function colorStringValue(color) {
|
|
309
310
|
return color?.toString();
|
|
310
311
|
}
|
|
311
|
-
function
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
const saturationLevel = saturation + level;
|
|
322
|
-
const clampedLevel = _clamp(saturationLevel, 0, 100);
|
|
323
|
-
const adjusted = setSaturation(c, clampedLevel);
|
|
324
|
-
array[index] = adjusted;
|
|
325
|
-
}
|
|
312
|
+
function adjustSaturation(colors, baseColor, options) {
|
|
313
|
+
if (options?.saturationLevels) {
|
|
314
|
+
return adjustSaturationByLevels(colors, baseColor, options.saturationLevels);
|
|
315
|
+
}
|
|
316
|
+
return adjustSaturationWithCurve(colors, baseColor, options?.saturationCurve);
|
|
317
|
+
}
|
|
318
|
+
function adjustSaturationByLevels(colors, baseColor, levels) {
|
|
319
|
+
return colors.map((color, index) => {
|
|
320
|
+
if (color === baseColor) {
|
|
321
|
+
return baseColor;
|
|
326
322
|
}
|
|
323
|
+
const level = levels[index];
|
|
324
|
+
if (level === undefined) {
|
|
325
|
+
return color;
|
|
326
|
+
}
|
|
327
|
+
const hsl = Color(color).hsl();
|
|
328
|
+
const newSaturation = _clamp(hsl.color[1] + level, 0, 100);
|
|
329
|
+
return Color.hsl(hsl.color[0], newSaturation, hsl.color[2]).hex();
|
|
327
330
|
});
|
|
328
|
-
return array;
|
|
329
331
|
}
|
|
330
|
-
function
|
|
331
|
-
|
|
332
|
-
|
|
332
|
+
function adjustSaturationWithCurve(colors, baseColor, customCurve) {
|
|
333
|
+
const baseSaturation = Color(baseColor).hsl().color[1];
|
|
334
|
+
if (baseSaturation <= SATURATION_THRESHOLD) {
|
|
335
|
+
return null;
|
|
333
336
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
const hsl = Color(baseColor).hsl();
|
|
338
|
-
const lightness = Math.round(hsl.color[2]);
|
|
339
|
-
if (lightness > lightnessLevel) {
|
|
340
|
-
const saturation = Math.round(hsl.color[1]);
|
|
341
|
-
if (saturation > saturationLevel) {
|
|
342
|
-
array = _map(colors, e => e !== baseColor ? setSaturation(e, saturationLevel) : e);
|
|
343
|
-
}
|
|
337
|
+
const baseIndex = colors.indexOf(baseColor.toUpperCase());
|
|
338
|
+
if (baseIndex === -1) {
|
|
339
|
+
return null;
|
|
344
340
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
341
|
+
const curve = customCurve ?? SATURATION_CURVE;
|
|
342
|
+
return colors.map((hex, i) => {
|
|
343
|
+
if (i === baseIndex) {
|
|
344
|
+
return hex;
|
|
345
|
+
}
|
|
346
|
+
const hsl = Color(hex).hsl();
|
|
347
|
+
const distance = Math.abs(i - baseIndex);
|
|
348
|
+
const percentage = curve[Math.min(distance, curve.length - 1)];
|
|
349
|
+
const newSaturation = Math.max(SATURATION_FLOOR, Math.round(baseSaturation * percentage));
|
|
350
|
+
return Color.hsl(hsl.color[0], newSaturation, hsl.color[2]).hex();
|
|
351
|
+
});
|
|
351
352
|
}
|
|
352
353
|
function generateColorTint(color, tintLevel) {
|
|
353
354
|
const hsl = Color(color).hsl();
|