@dloizides/ui-forms 1.50.0 → 1.52.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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +80 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.51.0] - 2026-11-24
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `ChipSelector` `size="dense"`: the `compact` 28 px pill in its 44 px hit box with no row gap, so wrapped rows stack at a 44 px pitch instead of 52 (MODC-1 S-23). Column gap and tap target unchanged; `compact` and `default` unchanged.
|
|
7
|
+
- `SelectControl` `native="fit"`: the web `<select>` sizes to its longest option instead of 100% width, so a narrow column no longer cuts the selected label (MODC-1 S-7). `native` / `native={true}` unchanged.
|
|
8
|
+
|
|
3
9
|
## [1.50.0] - 2026-11-24
|
|
4
10
|
|
|
5
11
|
### Added
|
package/dist/index.d.mts
CHANGED
|
@@ -660,8 +660,8 @@ declare const enum ChipLabelWrap {
|
|
|
660
660
|
/** Outline of an unselected chip. `default` = theme `border`; `strong` = theme `textSecondary`, a darker edge. */
|
|
661
661
|
type ChipOutlineTone = 'default' | 'strong';
|
|
662
662
|
|
|
663
|
-
/** Chip size. `default` =
|
|
664
|
-
type ChipSize = 'default' | 'compact';
|
|
663
|
+
/** Chip size. `default` = 44 px pill; `compact` = 28 px pill in a 44 px hit box; `dense` = `compact` with no row gap; `fit` = 28 px pill that is its own box (wide screens); `tap` = 44 px pill with a 13 px label. */
|
|
664
|
+
type ChipSize = 'default' | 'compact' | 'dense' | 'fit' | 'tap';
|
|
665
665
|
|
|
666
666
|
/**
|
|
667
667
|
* Public + internal types for ChipSelector. Split out of `ChipSelector.tsx` so the component, its
|
|
@@ -688,6 +688,8 @@ interface ChipOption<T> {
|
|
|
688
688
|
interface ChipSelectorProps<T> {
|
|
689
689
|
/** Optional — with no label, no label row is rendered (no phantom gap above the chips). */
|
|
690
690
|
label?: string;
|
|
691
|
+
/** Style for the label text, applied after the field label voice (e.g. a smaller label in a dense card). */
|
|
692
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
691
693
|
options: Array<ChipOption<T>>;
|
|
692
694
|
value: T | T[];
|
|
693
695
|
onChange: (value: T) => void;
|
|
@@ -731,7 +733,7 @@ interface ChipSelectorProps<T> {
|
|
|
731
733
|
* stays a toggle button with `aria-pressed`.
|
|
732
734
|
*/
|
|
733
735
|
singleSelectRole?: ChipSingleSelectRole;
|
|
734
|
-
/** `compact` = a 28 px pill (padding 4/10, label 12/600)
|
|
736
|
+
/** `compact` = a 28 px pill (padding 4/10, label 12/600) in a 44 px hit box; `dense` = `compact` with no row gap; defaults to `default`. */
|
|
735
737
|
size?: ChipSize;
|
|
736
738
|
/** Background of a selected chip, from the app's tokens; when set, a selected chip also shows a leading check. */
|
|
737
739
|
selectedFill?: string;
|
|
@@ -759,7 +761,7 @@ interface ChipSelectorProps<T> {
|
|
|
759
761
|
* resolvers (`chipIdentity`, colours, radio key logic) in `utils/`.
|
|
760
762
|
*/
|
|
761
763
|
|
|
762
|
-
declare const ChipSelector: <T extends string | number>({ label, options, value, onChange, multiple, disabled, variant, containerStyle, spacing, required, error, testID, chipTestIDPrefix, optionAccessibilityHint, singleSelectRole, size, selectedFill, outlineTone, }: ChipSelectorProps<T>) => React.ReactElement;
|
|
764
|
+
declare const ChipSelector: <T extends string | number>({ label, options, value, onChange, multiple, disabled, variant, containerStyle, spacing, required, error, testID, chipTestIDPrefix, optionAccessibilityHint, singleSelectRole, size, selectedFill, outlineTone, labelStyle, }: ChipSelectorProps<T>) => React.ReactElement;
|
|
763
765
|
|
|
764
766
|
/** `row` = label beside the switch (default); `box` = caption label over a bordered field box holding the state text and the switch. */
|
|
765
767
|
type FormSwitchVariant = 'row' | 'box';
|
|
@@ -888,8 +890,8 @@ interface SelectControlProps {
|
|
|
888
890
|
style?: StyleProp<ViewStyle>;
|
|
889
891
|
/** Trigger is `${testID}-trigger`, menu `${testID}-menu`, options `${testID}-option-${value}`. */
|
|
890
892
|
testID: string;
|
|
891
|
-
/** Web only: render a real `<select>` (
|
|
892
|
-
native?: boolean;
|
|
893
|
+
/** Web only: render a real `<select>` (plain `testID`); `'fit'` sizes it to its longest option instead of the full width. */
|
|
894
|
+
native?: boolean | 'fit';
|
|
893
895
|
}
|
|
894
896
|
declare function SelectControl(props: SelectControlProps): React.ReactElement;
|
|
895
897
|
|
package/dist/index.d.ts
CHANGED
|
@@ -660,8 +660,8 @@ declare const enum ChipLabelWrap {
|
|
|
660
660
|
/** Outline of an unselected chip. `default` = theme `border`; `strong` = theme `textSecondary`, a darker edge. */
|
|
661
661
|
type ChipOutlineTone = 'default' | 'strong';
|
|
662
662
|
|
|
663
|
-
/** Chip size. `default` =
|
|
664
|
-
type ChipSize = 'default' | 'compact';
|
|
663
|
+
/** Chip size. `default` = 44 px pill; `compact` = 28 px pill in a 44 px hit box; `dense` = `compact` with no row gap; `fit` = 28 px pill that is its own box (wide screens); `tap` = 44 px pill with a 13 px label. */
|
|
664
|
+
type ChipSize = 'default' | 'compact' | 'dense' | 'fit' | 'tap';
|
|
665
665
|
|
|
666
666
|
/**
|
|
667
667
|
* Public + internal types for ChipSelector. Split out of `ChipSelector.tsx` so the component, its
|
|
@@ -688,6 +688,8 @@ interface ChipOption<T> {
|
|
|
688
688
|
interface ChipSelectorProps<T> {
|
|
689
689
|
/** Optional — with no label, no label row is rendered (no phantom gap above the chips). */
|
|
690
690
|
label?: string;
|
|
691
|
+
/** Style for the label text, applied after the field label voice (e.g. a smaller label in a dense card). */
|
|
692
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
691
693
|
options: Array<ChipOption<T>>;
|
|
692
694
|
value: T | T[];
|
|
693
695
|
onChange: (value: T) => void;
|
|
@@ -731,7 +733,7 @@ interface ChipSelectorProps<T> {
|
|
|
731
733
|
* stays a toggle button with `aria-pressed`.
|
|
732
734
|
*/
|
|
733
735
|
singleSelectRole?: ChipSingleSelectRole;
|
|
734
|
-
/** `compact` = a 28 px pill (padding 4/10, label 12/600)
|
|
736
|
+
/** `compact` = a 28 px pill (padding 4/10, label 12/600) in a 44 px hit box; `dense` = `compact` with no row gap; defaults to `default`. */
|
|
735
737
|
size?: ChipSize;
|
|
736
738
|
/** Background of a selected chip, from the app's tokens; when set, a selected chip also shows a leading check. */
|
|
737
739
|
selectedFill?: string;
|
|
@@ -759,7 +761,7 @@ interface ChipSelectorProps<T> {
|
|
|
759
761
|
* resolvers (`chipIdentity`, colours, radio key logic) in `utils/`.
|
|
760
762
|
*/
|
|
761
763
|
|
|
762
|
-
declare const ChipSelector: <T extends string | number>({ label, options, value, onChange, multiple, disabled, variant, containerStyle, spacing, required, error, testID, chipTestIDPrefix, optionAccessibilityHint, singleSelectRole, size, selectedFill, outlineTone, }: ChipSelectorProps<T>) => React.ReactElement;
|
|
764
|
+
declare const ChipSelector: <T extends string | number>({ label, options, value, onChange, multiple, disabled, variant, containerStyle, spacing, required, error, testID, chipTestIDPrefix, optionAccessibilityHint, singleSelectRole, size, selectedFill, outlineTone, labelStyle, }: ChipSelectorProps<T>) => React.ReactElement;
|
|
763
765
|
|
|
764
766
|
/** `row` = label beside the switch (default); `box` = caption label over a bordered field box holding the state text and the switch. */
|
|
765
767
|
type FormSwitchVariant = 'row' | 'box';
|
|
@@ -888,8 +890,8 @@ interface SelectControlProps {
|
|
|
888
890
|
style?: StyleProp<ViewStyle>;
|
|
889
891
|
/** Trigger is `${testID}-trigger`, menu `${testID}-menu`, options `${testID}-option-${value}`. */
|
|
890
892
|
testID: string;
|
|
891
|
-
/** Web only: render a real `<select>` (
|
|
892
|
-
native?: boolean;
|
|
893
|
+
/** Web only: render a real `<select>` (plain `testID`); `'fit'` sizes it to its longest option instead of the full width. */
|
|
894
|
+
native?: boolean | 'fit';
|
|
893
895
|
}
|
|
894
896
|
declare function SelectControl(props: SelectControlProps): React.ReactElement;
|
|
895
897
|
|
package/dist/index.js
CHANGED
|
@@ -1423,6 +1423,11 @@ var COMPACT_PAD_H = 10;
|
|
|
1423
1423
|
var COMPACT_FONT_SIZE = 12;
|
|
1424
1424
|
var COMPACT_LINE_HEIGHT = 18;
|
|
1425
1425
|
var CHIP_BORDER = 1;
|
|
1426
|
+
var WIDE_MIN_TARGET_PX = 24;
|
|
1427
|
+
var TAP_PAD_H = 12;
|
|
1428
|
+
var TAP_FONT_SIZE = 13;
|
|
1429
|
+
var TAP_LINE_HEIGHT = 17;
|
|
1430
|
+
var PILL_RADIUS = 999;
|
|
1426
1431
|
var chipSizeStyles = reactNative.StyleSheet.create({
|
|
1427
1432
|
compactHitBox: {
|
|
1428
1433
|
minHeight: MIN_TARGET_PX,
|
|
@@ -1437,6 +1442,11 @@ var chipSizeStyles = reactNative.StyleSheet.create({
|
|
|
1437
1442
|
minWidth: 0,
|
|
1438
1443
|
borderWidth: CHIP_BORDER
|
|
1439
1444
|
},
|
|
1445
|
+
fitBox: { minHeight: WIDE_MIN_TARGET_PX, minWidth: WIDE_MIN_TARGET_PX, borderRadius: PILL_RADIUS, overflow: "hidden" },
|
|
1446
|
+
tapBox: { minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, borderRadius: PILL_RADIUS, overflow: "hidden" },
|
|
1447
|
+
pillVisual: { borderRadius: PILL_RADIUS },
|
|
1448
|
+
tapVisual: { paddingHorizontal: TAP_PAD_H, borderRadius: PILL_RADIUS, borderWidth: CHIP_BORDER },
|
|
1449
|
+
tapText: { fontSize: TAP_FONT_SIZE, fontWeight: "600", lineHeight: TAP_LINE_HEIGHT },
|
|
1440
1450
|
compactText: {
|
|
1441
1451
|
fontSize: COMPACT_FONT_SIZE,
|
|
1442
1452
|
fontWeight: "600",
|
|
@@ -1444,17 +1454,57 @@ var chipSizeStyles = reactNative.StyleSheet.create({
|
|
|
1444
1454
|
}
|
|
1445
1455
|
});
|
|
1446
1456
|
|
|
1457
|
+
// src/ChipSelector/ChipSize.ts
|
|
1458
|
+
function isCompactSize(size) {
|
|
1459
|
+
return size === "compact" || size === "dense";
|
|
1460
|
+
}
|
|
1461
|
+
function isFitSize(size) {
|
|
1462
|
+
return size === "fit" || size === "tap";
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1447
1465
|
// src/ChipSelector/utils/chipLook.ts
|
|
1448
|
-
function chipFill({ selected, selectedFill, ink, rest }) {
|
|
1466
|
+
function chipFill({ selected, selectedFill, ink, onDarkInk, rest }) {
|
|
1449
1467
|
if (!selected || selectedFill === void 0)
|
|
1450
1468
|
return { ...rest, checkColor: void 0 };
|
|
1451
|
-
|
|
1469
|
+
const fillInk = onDarkInk !== void 0 && isDarkColor(selectedFill) ? onDarkInk : ink;
|
|
1470
|
+
return { backgroundColor: selectedFill, textColor: fillInk, checkColor: fillInk };
|
|
1471
|
+
}
|
|
1472
|
+
var HEX_RGB = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;
|
|
1473
|
+
var FN_RGB = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i;
|
|
1474
|
+
var DARK_LUMINANCE = 0.4;
|
|
1475
|
+
var HEX_RADIX2 = 16;
|
|
1476
|
+
var CHANNEL_MAX = 255;
|
|
1477
|
+
var LUMA = { r: 0.2126, g: 0.7152, b: 0.0722 };
|
|
1478
|
+
function channels(color) {
|
|
1479
|
+
const hex = HEX_RGB.exec(color.trim());
|
|
1480
|
+
if (hex) return hex.slice(1).map((part) => parseInt(part, HEX_RADIX2));
|
|
1481
|
+
const fn = FN_RGB.exec(color.trim());
|
|
1482
|
+
return fn ? fn.slice(1).map(Number) : void 0;
|
|
1483
|
+
}
|
|
1484
|
+
function isDarkColor(color) {
|
|
1485
|
+
const rgb = channels(color);
|
|
1486
|
+
if (rgb === void 0) return false;
|
|
1487
|
+
const [r = 0, g = 0, b = 0] = rgb.map((c) => c / CHANNEL_MAX);
|
|
1488
|
+
return LUMA.r * r + LUMA.g * g + LUMA.b * b < DARK_LUMINANCE;
|
|
1452
1489
|
}
|
|
1453
1490
|
function chipSizeLook(size) {
|
|
1454
|
-
if (size
|
|
1491
|
+
if (size === "fit")
|
|
1492
|
+
return { hitBox: chipSizeStyles.fitBox, visual: [chipSizeStyles.compactVisual, chipSizeStyles.pillVisual], text: chipSizeStyles.compactText };
|
|
1493
|
+
if (size === "tap")
|
|
1494
|
+
return { hitBox: chipSizeStyles.tapBox, visual: chipSizeStyles.tapVisual, text: chipSizeStyles.tapText };
|
|
1495
|
+
if (!isCompactSize(size))
|
|
1455
1496
|
return { hitBox: void 0, visual: void 0, text: void 0 };
|
|
1456
1497
|
return { hitBox: chipSizeStyles.compactHitBox, visual: chipSizeStyles.compactVisual, text: chipSizeStyles.compactText };
|
|
1457
1498
|
}
|
|
1499
|
+
var DENSE_ROW_GAP = { rowGap: 0 };
|
|
1500
|
+
var FIT_GAP = { gap: 6 };
|
|
1501
|
+
function chipRowGap(size) {
|
|
1502
|
+
if (isFitSize(size)) return FIT_GAP;
|
|
1503
|
+
return size === "dense" ? DENSE_ROW_GAP : void 0;
|
|
1504
|
+
}
|
|
1505
|
+
function chipBoxFill(size, backgroundColor) {
|
|
1506
|
+
return isFitSize(size) ? { backgroundColor } : void 0;
|
|
1507
|
+
}
|
|
1458
1508
|
function restBorderColor(colors, tone) {
|
|
1459
1509
|
return tone === "strong" ? colors.borderStrong : colors.border;
|
|
1460
1510
|
}
|
|
@@ -1511,6 +1561,7 @@ function OutlineChip(props) {
|
|
|
1511
1561
|
selected,
|
|
1512
1562
|
selectedFill: props.selectedFill,
|
|
1513
1563
|
ink: colors.textStrong,
|
|
1564
|
+
onDarkInk: colors.onPrimary,
|
|
1514
1565
|
rest: { backgroundColor: selected ? colors.tint : colors.muted, textColor: active ? colors.primary : colors.textMuted }
|
|
1515
1566
|
});
|
|
1516
1567
|
const sized = chipSizeLook(props.size);
|
|
@@ -1527,7 +1578,7 @@ function OutlineChip(props) {
|
|
|
1527
1578
|
"aria-pressed": props.ariaPressed,
|
|
1528
1579
|
disabled,
|
|
1529
1580
|
hitSlop: CHIP_HIT_SLOP,
|
|
1530
|
-
style: [sized.hitBox, layout.boxStyle],
|
|
1581
|
+
style: [sized.hitBox, chipBoxFill(props.size, fill.backgroundColor), layout.boxStyle],
|
|
1531
1582
|
tabIndex: props.tabIndex,
|
|
1532
1583
|
testID,
|
|
1533
1584
|
onHoverIn: () => setHovered(true),
|
|
@@ -1553,6 +1604,7 @@ function SolidChip(props) {
|
|
|
1553
1604
|
selected,
|
|
1554
1605
|
selectedFill: props.selectedFill,
|
|
1555
1606
|
ink: colors.textStrong,
|
|
1607
|
+
onDarkInk: colors.onPrimary,
|
|
1556
1608
|
rest: { backgroundColor: selected ? colors.primary : TRANSPARENT_COLOR, textColor: selected ? colors.onPrimary : colors.textStrong }
|
|
1557
1609
|
});
|
|
1558
1610
|
const sized = chipSizeLook(props.size);
|
|
@@ -1570,7 +1622,7 @@ function SolidChip(props) {
|
|
|
1570
1622
|
"aria-pressed": props.ariaPressed,
|
|
1571
1623
|
disabled,
|
|
1572
1624
|
hitSlop: CHIP_HIT_SLOP,
|
|
1573
|
-
style: [sized.hitBox, layout.boxStyle],
|
|
1625
|
+
style: [sized.hitBox, chipBoxFill(props.size, fill.backgroundColor), layout.boxStyle],
|
|
1574
1626
|
testID,
|
|
1575
1627
|
onPress,
|
|
1576
1628
|
...rovingTabStop,
|
|
@@ -1647,7 +1699,7 @@ function useRadioKeyboard(config) {
|
|
|
1647
1699
|
var WHITE_COLOR = "#fff";
|
|
1648
1700
|
var OUTLINE_TINT_ALPHA = 0.1;
|
|
1649
1701
|
var HEX_SHORT_LENGTH2 = 3;
|
|
1650
|
-
var
|
|
1702
|
+
var HEX_RADIX3 = 16;
|
|
1651
1703
|
var RGB_R_START = 0;
|
|
1652
1704
|
var RGB_R_END = 2;
|
|
1653
1705
|
var RGB_G_END = 4;
|
|
@@ -1662,9 +1714,9 @@ function withAlpha2(hex, alpha) {
|
|
|
1662
1714
|
const normalized = hex.replace("#", "");
|
|
1663
1715
|
const isShort = normalized.length === HEX_SHORT_LENGTH2;
|
|
1664
1716
|
const full = isShort ? normalized.split("").map((c) => c + c).join("") : normalized;
|
|
1665
|
-
const r = parseInt(full.slice(RGB_R_START, RGB_R_END),
|
|
1666
|
-
const g = parseInt(full.slice(RGB_R_END, RGB_G_END),
|
|
1667
|
-
const b = parseInt(full.slice(RGB_G_END, RGB_B_END),
|
|
1717
|
+
const r = parseInt(full.slice(RGB_R_START, RGB_R_END), HEX_RADIX3);
|
|
1718
|
+
const g = parseInt(full.slice(RGB_R_END, RGB_G_END), HEX_RADIX3);
|
|
1719
|
+
const b = parseInt(full.slice(RGB_G_END, RGB_B_END), HEX_RADIX3);
|
|
1668
1720
|
const isValid = !Number.isNaN(r) && !Number.isNaN(g) && !Number.isNaN(b);
|
|
1669
1721
|
return isValid ? `rgba(${r}, ${g}, ${b}, ${alpha})` : hex;
|
|
1670
1722
|
}
|
|
@@ -1731,7 +1783,8 @@ var ChipSelector = ({
|
|
|
1731
1783
|
singleSelectRole = "button",
|
|
1732
1784
|
size = "default",
|
|
1733
1785
|
selectedFill,
|
|
1734
|
-
outlineTone = "default"
|
|
1786
|
+
outlineTone = "default",
|
|
1787
|
+
labelStyle
|
|
1735
1788
|
}) => {
|
|
1736
1789
|
const isRadioGroup = !multiple && singleSelectRole === "radio";
|
|
1737
1790
|
const { theme } = uiFeedback.useUi();
|
|
@@ -1780,6 +1833,7 @@ var ChipSelector = ({
|
|
|
1780
1833
|
containerStyle,
|
|
1781
1834
|
error,
|
|
1782
1835
|
label,
|
|
1836
|
+
labelStyle,
|
|
1783
1837
|
required,
|
|
1784
1838
|
spacing,
|
|
1785
1839
|
testID,
|
|
@@ -1787,7 +1841,7 @@ var ChipSelector = ({
|
|
|
1787
1841
|
reactNative.View,
|
|
1788
1842
|
{
|
|
1789
1843
|
accessibilityRole: isRadioGroup ? "radiogroup" : void 0,
|
|
1790
|
-
style: styles13.chipContainer,
|
|
1844
|
+
style: [styles13.chipContainer, chipRowGap(size)],
|
|
1791
1845
|
...webFieldA11y({ describedById, hasError }),
|
|
1792
1846
|
...radio.groupProps,
|
|
1793
1847
|
children: options.map(renderChip)
|
|
@@ -2122,11 +2176,18 @@ var NATIVE_SELECT_BOX = {
|
|
|
2122
2176
|
fontFamily: "inherit",
|
|
2123
2177
|
width: "100%"
|
|
2124
2178
|
};
|
|
2125
|
-
|
|
2179
|
+
var FIT_SELECT_BOX = { width: "auto", maxWidth: "none" };
|
|
2180
|
+
var fitStyles = reactNative.StyleSheet.create({
|
|
2181
|
+
anchor: { alignSelf: "flex-start", flexShrink: 0 }
|
|
2182
|
+
});
|
|
2183
|
+
function nativeSelectBox(fit) {
|
|
2184
|
+
return fit ? { ...NATIVE_SELECT_BOX, ...FIT_SELECT_BOX } : NATIVE_SELECT_BOX;
|
|
2185
|
+
}
|
|
2186
|
+
function nativeSelectStyle(fit, borderColor, backgroundColor, color) {
|
|
2126
2187
|
const trigger = reactNative.StyleSheet.flatten(controlStyles.selectTrigger);
|
|
2127
2188
|
const text = reactNative.StyleSheet.flatten(controlStyles.selectTriggerText);
|
|
2128
2189
|
return {
|
|
2129
|
-
...
|
|
2190
|
+
...nativeSelectBox(fit),
|
|
2130
2191
|
minHeight: trigger.minHeight,
|
|
2131
2192
|
borderWidth: trigger.borderWidth,
|
|
2132
2193
|
borderRadius: trigger.borderRadius,
|
|
@@ -2147,20 +2208,22 @@ function NativeSelect({
|
|
|
2147
2208
|
accessibilityHint,
|
|
2148
2209
|
labelledById,
|
|
2149
2210
|
style,
|
|
2150
|
-
testID
|
|
2211
|
+
testID,
|
|
2212
|
+
native
|
|
2151
2213
|
}) {
|
|
2152
2214
|
const { theme } = uiFeedback.useUi();
|
|
2153
2215
|
const { colors } = theme;
|
|
2154
2216
|
const hasMatch = options.some((o) => o.value === value);
|
|
2155
2217
|
const textColor = hasMatch ? colors.text : colors.textSecondary;
|
|
2218
|
+
const fit = native === "fit";
|
|
2156
2219
|
const handleChange = (event) => onChange(event.target.value);
|
|
2157
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [controlStyles.anchor, style], children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2220
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [controlStyles.anchor, fit ? fitStyles.anchor : void 0, style], children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2158
2221
|
"select",
|
|
2159
2222
|
{
|
|
2160
2223
|
"aria-label": accessibilityLabel,
|
|
2161
2224
|
"aria-labelledby": labelledById,
|
|
2162
2225
|
"data-testid": testID,
|
|
2163
|
-
style: nativeSelectStyle(colors.border, colors.surfaceElevated, textColor),
|
|
2226
|
+
style: nativeSelectStyle(fit, colors.border, colors.surfaceElevated, textColor),
|
|
2164
2227
|
title: accessibilityHint,
|
|
2165
2228
|
value,
|
|
2166
2229
|
onChange: handleChange,
|
|
@@ -2214,7 +2277,7 @@ function listboxTriggerAria(testID, hasList, highlighted) {
|
|
|
2214
2277
|
};
|
|
2215
2278
|
}
|
|
2216
2279
|
function SelectControl(props) {
|
|
2217
|
-
return props.native === true && IS_WEB7 ? /* @__PURE__ */ jsxRuntime.jsx(NativeSelect, { ...props }) : /* @__PURE__ */ jsxRuntime.jsx(MenuSelectControl, { ...props });
|
|
2280
|
+
return (props.native === true || props.native === "fit") && IS_WEB7 ? /* @__PURE__ */ jsxRuntime.jsx(NativeSelect, { ...props }) : /* @__PURE__ */ jsxRuntime.jsx(MenuSelectControl, { ...props });
|
|
2218
2281
|
}
|
|
2219
2282
|
function MenuSelectControl({
|
|
2220
2283
|
options,
|