@scripso-homepad/ui 0.4.6 → 0.4.8
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/README.md +1 -1
- package/dist/{chunk-Y7I7LA2K.js → chunk-DAOLVE64.js} +19 -23
- package/dist/chunk-DAOLVE64.js.map +1 -0
- package/dist/index.cjs +51 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -32
- package/dist/index.d.ts +34 -32
- package/dist/index.js +37 -15
- package/dist/index.js.map +1 -1
- package/dist/web/index.cjs +10 -14
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.js +5 -5
- package/dist/web/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Select.tsx +43 -13
- package/src/icons/ArrowUpRightIcon.tsx +1 -1
- package/src/icons/ArrowUpRightIcon.web.tsx +1 -1
- package/src/theme/input.ts +4 -9
- package/src/theme/select.ts +20 -6
- package/src/theme/tokens.ts +14 -14
- package/src/web/components/TableActionsMenu.tsx +2 -2
- package/src/web/icons/TableMenuInfoIcon.tsx +2 -2
- package/dist/chunk-Y7I7LA2K.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -70,6 +70,8 @@ interface SelectBaseProps {
|
|
|
70
70
|
labelClassName?: string;
|
|
71
71
|
errorClassName?: string;
|
|
72
72
|
hintClassName?: string;
|
|
73
|
+
/** Shorter option rows for compact filter-style dropdowns. */
|
|
74
|
+
compact?: boolean;
|
|
73
75
|
}
|
|
74
76
|
interface SingleSelectProps extends SelectBaseProps {
|
|
75
77
|
multiple?: false;
|
|
@@ -82,7 +84,7 @@ interface MultipleSelectProps extends SelectBaseProps {
|
|
|
82
84
|
onValueChange?: (value: string[]) => void;
|
|
83
85
|
}
|
|
84
86
|
type SelectProps = SingleSelectProps | MultipleSelectProps;
|
|
85
|
-
declare function Select({ label, placeholder, value, onValueChange, options, leftIcon, multiple, disabled, error, invalid, hint, containerStyle, fieldStyle, className, fieldClassName, menuClassName, labelClassName, errorClassName, hintClassName, }: SelectProps): react.JSX.Element;
|
|
87
|
+
declare function Select({ label, placeholder, value, onValueChange, options, leftIcon, multiple, disabled, error, invalid, hint, containerStyle, fieldStyle, className, fieldClassName, menuClassName, labelClassName, errorClassName, hintClassName, compact, }: SelectProps): react.JSX.Element;
|
|
86
88
|
|
|
87
89
|
interface PhoneInputProps extends Omit<TextInputProps, "style"> {
|
|
88
90
|
label?: string;
|
|
@@ -257,18 +259,18 @@ declare const stormGray: {
|
|
|
257
259
|
type StormGrayStep = keyof typeof stormGray;
|
|
258
260
|
/** Navy scale — Figma steps 0 → 8.5 */
|
|
259
261
|
declare const navy: {
|
|
260
|
-
readonly "0": "#
|
|
261
|
-
readonly "0.5": "#
|
|
262
|
-
readonly "1": "#
|
|
263
|
-
readonly "1.5": "#
|
|
264
|
-
readonly "2": "#
|
|
265
|
-
readonly "3": "#
|
|
266
|
-
readonly "4": "#
|
|
267
|
-
readonly "5": "#
|
|
268
|
-
readonly "6": "#
|
|
269
|
-
readonly "7": "#
|
|
270
|
-
readonly "8": "#
|
|
271
|
-
readonly "8.5": "#
|
|
262
|
+
readonly "0": "#f6fafe";
|
|
263
|
+
readonly "0.5": "#dee5eb";
|
|
264
|
+
readonly "1": "#c6d0d8";
|
|
265
|
+
readonly "1.5": "#afbac5";
|
|
266
|
+
readonly "2": "#97a5b2";
|
|
267
|
+
readonly "3": "#677b8c";
|
|
268
|
+
readonly "4": "#385066";
|
|
269
|
+
readonly "5": "#082640";
|
|
270
|
+
readonly "6": "#061e33";
|
|
271
|
+
readonly "7": "#051726";
|
|
272
|
+
readonly "8": "#030f1a";
|
|
273
|
+
readonly "8.5": "#020b13";
|
|
272
274
|
};
|
|
273
275
|
type NavyStep = keyof typeof navy;
|
|
274
276
|
/** Ruby Red scale — Figma steps 0 → 8.5 */
|
|
@@ -307,7 +309,7 @@ type EmeraldGreenStep = keyof typeof emeraldGreen;
|
|
|
307
309
|
declare const brand: {
|
|
308
310
|
readonly slateBlue: "#182e3c";
|
|
309
311
|
readonly stormGray: "#455765";
|
|
310
|
-
readonly navy: "#
|
|
312
|
+
readonly navy: "#082640";
|
|
311
313
|
readonly rubyRed: "#ae0011";
|
|
312
314
|
readonly emeraldGreen: "#279d54";
|
|
313
315
|
};
|
|
@@ -341,20 +343,20 @@ declare const colors: {
|
|
|
341
343
|
readonly rubyRed850: "#340005";
|
|
342
344
|
/** Primary brand ruby red — Figma Ruby Red 5 */
|
|
343
345
|
readonly rubyRed: "#ae0011";
|
|
344
|
-
readonly navy0: "#
|
|
345
|
-
readonly navy50: "#
|
|
346
|
-
readonly navy100: "#
|
|
347
|
-
readonly navy150: "#
|
|
348
|
-
readonly navy200: "#
|
|
349
|
-
readonly navy300: "#
|
|
350
|
-
readonly navy400: "#
|
|
351
|
-
readonly navy500: "#
|
|
352
|
-
readonly navy600: "#
|
|
353
|
-
readonly navy700: "#
|
|
354
|
-
readonly navy800: "#
|
|
355
|
-
readonly navy850: "#
|
|
346
|
+
readonly navy0: "#f6fafe";
|
|
347
|
+
readonly navy50: "#dee5eb";
|
|
348
|
+
readonly navy100: "#c6d0d8";
|
|
349
|
+
readonly navy150: "#afbac5";
|
|
350
|
+
readonly navy200: "#97a5b2";
|
|
351
|
+
readonly navy300: "#677b8c";
|
|
352
|
+
readonly navy400: "#385066";
|
|
353
|
+
readonly navy500: "#082640";
|
|
354
|
+
readonly navy600: "#061e33";
|
|
355
|
+
readonly navy700: "#051726";
|
|
356
|
+
readonly navy800: "#030f1a";
|
|
357
|
+
readonly navy850: "#020b13";
|
|
356
358
|
/** Primary brand navy — Figma Navy 5 */
|
|
357
|
-
readonly navy: "#
|
|
359
|
+
readonly navy: "#082640";
|
|
358
360
|
readonly stormGray0: "#fbfcfc";
|
|
359
361
|
readonly stormGray50: "#eceef0";
|
|
360
362
|
readonly stormGray100: "#dadde0";
|
|
@@ -390,7 +392,7 @@ declare const colors: {
|
|
|
390
392
|
readonly errorLight: "#fee2e2";
|
|
391
393
|
/** @deprecated Use `rubyRed` */
|
|
392
394
|
readonly inputError: "#ae0011";
|
|
393
|
-
readonly inputOutlineFocus: "#
|
|
395
|
+
readonly inputOutlineFocus: "#dee5eb";
|
|
394
396
|
readonly inputOutlineError: "#f7dddf";
|
|
395
397
|
readonly warning: "#92400e";
|
|
396
398
|
readonly warningBg: "#fef3c7";
|
|
@@ -441,13 +443,13 @@ declare const labelTypography: {
|
|
|
441
443
|
readonly lineHeight: 12;
|
|
442
444
|
readonly letterSpacing: 0;
|
|
443
445
|
};
|
|
444
|
-
/** Button label typography — SemiBold
|
|
446
|
+
/** Button label typography — SemiBold. */
|
|
445
447
|
declare const buttonTypography: {
|
|
446
448
|
readonly lg: {
|
|
447
449
|
readonly fontFamily: "Noto Sans Armenian";
|
|
448
450
|
readonly fontSize: 14;
|
|
449
451
|
readonly fontWeight: "600";
|
|
450
|
-
readonly lineHeight:
|
|
452
|
+
readonly lineHeight: 19;
|
|
451
453
|
readonly letterSpacing: 0;
|
|
452
454
|
};
|
|
453
455
|
readonly sm: {
|
|
@@ -460,7 +462,7 @@ declare const buttonTypography: {
|
|
|
460
462
|
};
|
|
461
463
|
declare const shadows: {
|
|
462
464
|
readonly card: {
|
|
463
|
-
readonly shadowColor: "#
|
|
465
|
+
readonly shadowColor: "#082640";
|
|
464
466
|
readonly shadowOffset: {
|
|
465
467
|
readonly width: 0;
|
|
466
468
|
readonly height: 4;
|
|
@@ -470,7 +472,7 @@ declare const shadows: {
|
|
|
470
472
|
readonly elevation: 2;
|
|
471
473
|
};
|
|
472
474
|
readonly cardLg: {
|
|
473
|
-
readonly shadowColor: "#
|
|
475
|
+
readonly shadowColor: "#082640";
|
|
474
476
|
readonly shadowOffset: {
|
|
475
477
|
readonly width: 0;
|
|
476
478
|
readonly height: 4;
|
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,8 @@ interface SelectBaseProps {
|
|
|
70
70
|
labelClassName?: string;
|
|
71
71
|
errorClassName?: string;
|
|
72
72
|
hintClassName?: string;
|
|
73
|
+
/** Shorter option rows for compact filter-style dropdowns. */
|
|
74
|
+
compact?: boolean;
|
|
73
75
|
}
|
|
74
76
|
interface SingleSelectProps extends SelectBaseProps {
|
|
75
77
|
multiple?: false;
|
|
@@ -82,7 +84,7 @@ interface MultipleSelectProps extends SelectBaseProps {
|
|
|
82
84
|
onValueChange?: (value: string[]) => void;
|
|
83
85
|
}
|
|
84
86
|
type SelectProps = SingleSelectProps | MultipleSelectProps;
|
|
85
|
-
declare function Select({ label, placeholder, value, onValueChange, options, leftIcon, multiple, disabled, error, invalid, hint, containerStyle, fieldStyle, className, fieldClassName, menuClassName, labelClassName, errorClassName, hintClassName, }: SelectProps): react.JSX.Element;
|
|
87
|
+
declare function Select({ label, placeholder, value, onValueChange, options, leftIcon, multiple, disabled, error, invalid, hint, containerStyle, fieldStyle, className, fieldClassName, menuClassName, labelClassName, errorClassName, hintClassName, compact, }: SelectProps): react.JSX.Element;
|
|
86
88
|
|
|
87
89
|
interface PhoneInputProps extends Omit<TextInputProps, "style"> {
|
|
88
90
|
label?: string;
|
|
@@ -257,18 +259,18 @@ declare const stormGray: {
|
|
|
257
259
|
type StormGrayStep = keyof typeof stormGray;
|
|
258
260
|
/** Navy scale — Figma steps 0 → 8.5 */
|
|
259
261
|
declare const navy: {
|
|
260
|
-
readonly "0": "#
|
|
261
|
-
readonly "0.5": "#
|
|
262
|
-
readonly "1": "#
|
|
263
|
-
readonly "1.5": "#
|
|
264
|
-
readonly "2": "#
|
|
265
|
-
readonly "3": "#
|
|
266
|
-
readonly "4": "#
|
|
267
|
-
readonly "5": "#
|
|
268
|
-
readonly "6": "#
|
|
269
|
-
readonly "7": "#
|
|
270
|
-
readonly "8": "#
|
|
271
|
-
readonly "8.5": "#
|
|
262
|
+
readonly "0": "#f6fafe";
|
|
263
|
+
readonly "0.5": "#dee5eb";
|
|
264
|
+
readonly "1": "#c6d0d8";
|
|
265
|
+
readonly "1.5": "#afbac5";
|
|
266
|
+
readonly "2": "#97a5b2";
|
|
267
|
+
readonly "3": "#677b8c";
|
|
268
|
+
readonly "4": "#385066";
|
|
269
|
+
readonly "5": "#082640";
|
|
270
|
+
readonly "6": "#061e33";
|
|
271
|
+
readonly "7": "#051726";
|
|
272
|
+
readonly "8": "#030f1a";
|
|
273
|
+
readonly "8.5": "#020b13";
|
|
272
274
|
};
|
|
273
275
|
type NavyStep = keyof typeof navy;
|
|
274
276
|
/** Ruby Red scale — Figma steps 0 → 8.5 */
|
|
@@ -307,7 +309,7 @@ type EmeraldGreenStep = keyof typeof emeraldGreen;
|
|
|
307
309
|
declare const brand: {
|
|
308
310
|
readonly slateBlue: "#182e3c";
|
|
309
311
|
readonly stormGray: "#455765";
|
|
310
|
-
readonly navy: "#
|
|
312
|
+
readonly navy: "#082640";
|
|
311
313
|
readonly rubyRed: "#ae0011";
|
|
312
314
|
readonly emeraldGreen: "#279d54";
|
|
313
315
|
};
|
|
@@ -341,20 +343,20 @@ declare const colors: {
|
|
|
341
343
|
readonly rubyRed850: "#340005";
|
|
342
344
|
/** Primary brand ruby red — Figma Ruby Red 5 */
|
|
343
345
|
readonly rubyRed: "#ae0011";
|
|
344
|
-
readonly navy0: "#
|
|
345
|
-
readonly navy50: "#
|
|
346
|
-
readonly navy100: "#
|
|
347
|
-
readonly navy150: "#
|
|
348
|
-
readonly navy200: "#
|
|
349
|
-
readonly navy300: "#
|
|
350
|
-
readonly navy400: "#
|
|
351
|
-
readonly navy500: "#
|
|
352
|
-
readonly navy600: "#
|
|
353
|
-
readonly navy700: "#
|
|
354
|
-
readonly navy800: "#
|
|
355
|
-
readonly navy850: "#
|
|
346
|
+
readonly navy0: "#f6fafe";
|
|
347
|
+
readonly navy50: "#dee5eb";
|
|
348
|
+
readonly navy100: "#c6d0d8";
|
|
349
|
+
readonly navy150: "#afbac5";
|
|
350
|
+
readonly navy200: "#97a5b2";
|
|
351
|
+
readonly navy300: "#677b8c";
|
|
352
|
+
readonly navy400: "#385066";
|
|
353
|
+
readonly navy500: "#082640";
|
|
354
|
+
readonly navy600: "#061e33";
|
|
355
|
+
readonly navy700: "#051726";
|
|
356
|
+
readonly navy800: "#030f1a";
|
|
357
|
+
readonly navy850: "#020b13";
|
|
356
358
|
/** Primary brand navy — Figma Navy 5 */
|
|
357
|
-
readonly navy: "#
|
|
359
|
+
readonly navy: "#082640";
|
|
358
360
|
readonly stormGray0: "#fbfcfc";
|
|
359
361
|
readonly stormGray50: "#eceef0";
|
|
360
362
|
readonly stormGray100: "#dadde0";
|
|
@@ -390,7 +392,7 @@ declare const colors: {
|
|
|
390
392
|
readonly errorLight: "#fee2e2";
|
|
391
393
|
/** @deprecated Use `rubyRed` */
|
|
392
394
|
readonly inputError: "#ae0011";
|
|
393
|
-
readonly inputOutlineFocus: "#
|
|
395
|
+
readonly inputOutlineFocus: "#dee5eb";
|
|
394
396
|
readonly inputOutlineError: "#f7dddf";
|
|
395
397
|
readonly warning: "#92400e";
|
|
396
398
|
readonly warningBg: "#fef3c7";
|
|
@@ -441,13 +443,13 @@ declare const labelTypography: {
|
|
|
441
443
|
readonly lineHeight: 12;
|
|
442
444
|
readonly letterSpacing: 0;
|
|
443
445
|
};
|
|
444
|
-
/** Button label typography — SemiBold
|
|
446
|
+
/** Button label typography — SemiBold. */
|
|
445
447
|
declare const buttonTypography: {
|
|
446
448
|
readonly lg: {
|
|
447
449
|
readonly fontFamily: "Noto Sans Armenian";
|
|
448
450
|
readonly fontSize: 14;
|
|
449
451
|
readonly fontWeight: "600";
|
|
450
|
-
readonly lineHeight:
|
|
452
|
+
readonly lineHeight: 19;
|
|
451
453
|
readonly letterSpacing: 0;
|
|
452
454
|
};
|
|
453
455
|
readonly sm: {
|
|
@@ -460,7 +462,7 @@ declare const buttonTypography: {
|
|
|
460
462
|
};
|
|
461
463
|
declare const shadows: {
|
|
462
464
|
readonly card: {
|
|
463
|
-
readonly shadowColor: "#
|
|
465
|
+
readonly shadowColor: "#082640";
|
|
464
466
|
readonly shadowOffset: {
|
|
465
467
|
readonly width: 0;
|
|
466
468
|
readonly height: 4;
|
|
@@ -470,7 +472,7 @@ declare const shadows: {
|
|
|
470
472
|
readonly elevation: 2;
|
|
471
473
|
};
|
|
472
474
|
readonly cardLg: {
|
|
473
|
-
readonly shadowColor: "#
|
|
475
|
+
readonly shadowColor: "#082640";
|
|
474
476
|
readonly shadowOffset: {
|
|
475
477
|
readonly width: 0;
|
|
476
478
|
readonly height: 4;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { colors, buttonTypography, spacing, fontSize, fontWeight, fonts, radii, INPUT_ICON_GAP, useApplyWebClassName, resolveInputVisualState, Label, getInputFieldStyles, inputFieldMetrics } from './chunk-
|
|
2
|
-
export { Input, Label, brand, buttonTypography, colors, emeraldGreen, fontSize, fontWeight, fonts, labelTypography, navy, radii, rubyRed, shadows, spacing, stormGray } from './chunk-
|
|
3
|
-
import { createContext, useRef, useState,
|
|
1
|
+
import { colors, buttonTypography, spacing, fontSize, fontWeight, fonts, radii, INPUT_ICON_GAP, useApplyWebClassName, resolveInputVisualState, Label, getInputFieldStyles, inputFieldMetrics } from './chunk-DAOLVE64.js';
|
|
2
|
+
export { Input, Label, brand, buttonTypography, colors, emeraldGreen, fontSize, fontWeight, fonts, labelTypography, navy, radii, rubyRed, shadows, spacing, stormGray } from './chunk-DAOLVE64.js';
|
|
3
|
+
import { createContext, useRef, useState, useMemo, useEffect, useLayoutEffect, useContext, isValidElement, cloneElement } from 'react';
|
|
4
4
|
import { StyleSheet, Platform, TouchableOpacity, Text, View, Animated, Easing, Pressable, Modal, ScrollView, TextInput, Dimensions } from 'react-native';
|
|
5
5
|
import Svg3, { Path } from 'react-native-svg';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -9,7 +9,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
9
9
|
var ARROW_UP_RIGHT_PATH = "M14.1667 14.1668V5.8335H5.83333M14.1667 5.8335L5.83333 14.1668";
|
|
10
10
|
function ArrowUpRightIcon({
|
|
11
11
|
size = 20,
|
|
12
|
-
color = "#
|
|
12
|
+
color = "#082640",
|
|
13
13
|
strokeWidth = 2
|
|
14
14
|
}) {
|
|
15
15
|
return /* @__PURE__ */ jsx(Svg3, { width: size, height: size, viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx(
|
|
@@ -229,10 +229,12 @@ var SELECT_DROPDOWN_GAP = spacing.sm;
|
|
|
229
229
|
var SELECT_DROPDOWN_PADDING = spacing.sm;
|
|
230
230
|
var SELECT_DROPDOWN_MAX_HEIGHT = 317;
|
|
231
231
|
var SELECT_OPTION_HEIGHT = 43;
|
|
232
|
+
var SELECT_OPTION_HEIGHT_COMPACT = 36;
|
|
232
233
|
var SELECT_OPTION_GAP = spacing.sm;
|
|
233
234
|
var SELECT_CHEVRON_SIZE = 20;
|
|
234
235
|
var SELECT_CHEVRON_COLOR = colors.stormGray150;
|
|
235
236
|
var SELECT_CHEVRON_ROTATION_MS = 200;
|
|
237
|
+
var SELECT_TEXT_LINE_HEIGHT = 19;
|
|
236
238
|
var selectLabelTypography = {
|
|
237
239
|
fontFamily: fonts.sans,
|
|
238
240
|
fontSize: fontSize.sm,
|
|
@@ -245,7 +247,7 @@ var selectValueTypography = {
|
|
|
245
247
|
fontFamily: fonts.sans,
|
|
246
248
|
fontSize: fontSize.md,
|
|
247
249
|
fontWeight: fontWeight.regular,
|
|
248
|
-
lineHeight:
|
|
250
|
+
lineHeight: SELECT_TEXT_LINE_HEIGHT,
|
|
249
251
|
letterSpacing: 0,
|
|
250
252
|
textAlign: "left"
|
|
251
253
|
};
|
|
@@ -263,8 +265,8 @@ function createOutlineStyle(ringColor) {
|
|
|
263
265
|
};
|
|
264
266
|
}
|
|
265
267
|
var defaultOutline = {
|
|
266
|
-
borderRadius: radii.lg,
|
|
267
|
-
borderWidth:
|
|
268
|
+
borderRadius: radii.lg + INPUT_OUTLINE_WIDTH,
|
|
269
|
+
borderWidth: INPUT_OUTLINE_WIDTH,
|
|
268
270
|
borderColor: colors.transparent,
|
|
269
271
|
padding: 0,
|
|
270
272
|
backgroundColor: colors.transparent,
|
|
@@ -386,7 +388,7 @@ var selectDropdownMetrics = StyleSheet.create({
|
|
|
386
388
|
fontFamily: fonts.sans,
|
|
387
389
|
fontSize: fontSize.md,
|
|
388
390
|
fontWeight: fontWeight.regular,
|
|
389
|
-
lineHeight:
|
|
391
|
+
lineHeight: SELECT_TEXT_LINE_HEIGHT,
|
|
390
392
|
letterSpacing: 0,
|
|
391
393
|
textAlign: "left",
|
|
392
394
|
color: colors.slateBlue,
|
|
@@ -409,10 +411,13 @@ var selectDropdownMetrics = StyleSheet.create({
|
|
|
409
411
|
backgroundColor: colors.stormGray0
|
|
410
412
|
}
|
|
411
413
|
});
|
|
412
|
-
function resolveSelectDropdownHeight(optionCount) {
|
|
413
|
-
const contentHeight = optionCount *
|
|
414
|
+
function resolveSelectDropdownHeight(optionCount, optionHeight = SELECT_OPTION_HEIGHT) {
|
|
415
|
+
const contentHeight = optionCount * optionHeight + Math.max(0, optionCount - 1) * SELECT_OPTION_GAP + SELECT_DROPDOWN_PADDING * 2;
|
|
414
416
|
return Math.min(contentHeight, SELECT_DROPDOWN_MAX_HEIGHT);
|
|
415
417
|
}
|
|
418
|
+
function resolveSelectDropdownContentHeight(optionCount, optionHeight = SELECT_OPTION_HEIGHT) {
|
|
419
|
+
return optionCount * optionHeight + Math.max(0, optionCount - 1) * SELECT_OPTION_GAP;
|
|
420
|
+
}
|
|
416
421
|
function resolveSelectDropdownTop(anchor, dropdownHeight) {
|
|
417
422
|
const windowHeight = Dimensions.get("window").height;
|
|
418
423
|
const spaceBelow = windowHeight - (anchor.y + anchor.height + SELECT_DROPDOWN_GAP);
|
|
@@ -583,7 +588,8 @@ function Select({
|
|
|
583
588
|
menuClassName,
|
|
584
589
|
labelClassName,
|
|
585
590
|
errorClassName,
|
|
586
|
-
hintClassName
|
|
591
|
+
hintClassName,
|
|
592
|
+
compact = false
|
|
587
593
|
}) {
|
|
588
594
|
const wrapperRef = useRef(null);
|
|
589
595
|
const triggerRef = useRef(null);
|
|
@@ -595,10 +601,15 @@ function Select({
|
|
|
595
601
|
const [anchor, setAnchor] = useState(null);
|
|
596
602
|
const [highlightedIndex, setHighlightedIndex] = useState(-1);
|
|
597
603
|
const [valueContainerWidth, setValueContainerWidth] = useState(0);
|
|
604
|
+
const optionHeight = compact ? SELECT_OPTION_HEIGHT_COMPACT : SELECT_OPTION_HEIGHT;
|
|
605
|
+
const needsScroll = useMemo(
|
|
606
|
+
() => resolveSelectDropdownContentHeight(options.length, optionHeight) > SELECT_DROPDOWN_MAX_HEIGHT - SELECT_DROPDOWN_PADDING * 2,
|
|
607
|
+
[compact, optionHeight, options.length]
|
|
608
|
+
);
|
|
598
609
|
useApplyWebClassName(wrapperRef, className);
|
|
599
610
|
useApplyWebClassName(triggerRef, fieldClassName);
|
|
600
611
|
useApplyWebClassName(menuRef, menuClassName);
|
|
601
|
-
useApplyWebClassName(scrollRef, SELECT_DROPDOWN_SCROLL_CLASS, open && Boolean(anchor));
|
|
612
|
+
useApplyWebClassName(scrollRef, SELECT_DROPDOWN_SCROLL_CLASS, open && Boolean(anchor) && needsScroll);
|
|
602
613
|
useApplyWebClassName(helperRef, error ? errorClassName : hintClassName);
|
|
603
614
|
useIsomorphicLayoutEffect(() => {
|
|
604
615
|
ensureSelectDropdownScrollStyles();
|
|
@@ -654,7 +665,7 @@ function Select({
|
|
|
654
665
|
return formatMultiSelectDisplay(selectedLabels, valueContainerWidth);
|
|
655
666
|
}, [multiple, placeholder, selectedLabels, valueContainerWidth]);
|
|
656
667
|
const isPlaceholder = selectedLabels.length === 0;
|
|
657
|
-
const dropdownHeight = resolveSelectDropdownHeight(options.length);
|
|
668
|
+
const dropdownHeight = resolveSelectDropdownHeight(options.length, optionHeight);
|
|
658
669
|
const helperMessage = error ?? hint;
|
|
659
670
|
function closeMenu() {
|
|
660
671
|
setOpen(false);
|
|
@@ -706,7 +717,10 @@ function Select({
|
|
|
706
717
|
},
|
|
707
718
|
style: [
|
|
708
719
|
selectDropdownMetrics.option,
|
|
720
|
+
compact && styles2.optionCompact,
|
|
721
|
+
{ height: optionHeight, minHeight: optionHeight, maxHeight: optionHeight },
|
|
709
722
|
isSelected && selectDropdownMetrics.optionSelected,
|
|
723
|
+
compact && isSelected && styles2.optionSelectedCompact,
|
|
710
724
|
isHighlighted && !isSelected && !option.disabled ? selectDropdownMetrics.optionHighlighted : null,
|
|
711
725
|
!isLast && styles2.optionSpacing,
|
|
712
726
|
option.disabled && styles2.optionDisabled
|
|
@@ -793,7 +807,7 @@ function Select({
|
|
|
793
807
|
height: dropdownHeight
|
|
794
808
|
}
|
|
795
809
|
],
|
|
796
|
-
children: /* @__PURE__ */ jsx(
|
|
810
|
+
children: needsScroll ? /* @__PURE__ */ jsx(
|
|
797
811
|
ScrollView,
|
|
798
812
|
{
|
|
799
813
|
ref: scrollRef,
|
|
@@ -805,7 +819,7 @@ function Select({
|
|
|
805
819
|
nestedScrollEnabled: true,
|
|
806
820
|
children: optionList
|
|
807
821
|
}
|
|
808
|
-
)
|
|
822
|
+
) : /* @__PURE__ */ jsx(View, { style: styles2.dropdownContent, children: optionList })
|
|
809
823
|
}
|
|
810
824
|
) : null }) })
|
|
811
825
|
] });
|
|
@@ -846,6 +860,14 @@ var styles2 = StyleSheet.create({
|
|
|
846
860
|
optionSpacing: {
|
|
847
861
|
marginBottom: SELECT_OPTION_GAP
|
|
848
862
|
},
|
|
863
|
+
optionCompact: {
|
|
864
|
+
paddingTop: 8,
|
|
865
|
+
paddingBottom: 8
|
|
866
|
+
},
|
|
867
|
+
optionSelectedCompact: {
|
|
868
|
+
paddingTop: 8,
|
|
869
|
+
paddingBottom: 8
|
|
870
|
+
},
|
|
849
871
|
optionDisabled: {
|
|
850
872
|
opacity: 0.5
|
|
851
873
|
},
|