@dloizides/ui-forms 1.50.0 → 1.51.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 +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +26 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1437,6 +1437,11 @@ var chipSizeStyles = StyleSheet.create({
|
|
|
1437
1437
|
}
|
|
1438
1438
|
});
|
|
1439
1439
|
|
|
1440
|
+
// src/ChipSelector/ChipSize.ts
|
|
1441
|
+
function isCompactSize(size) {
|
|
1442
|
+
return size === "compact" || size === "dense";
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1440
1445
|
// src/ChipSelector/utils/chipLook.ts
|
|
1441
1446
|
function chipFill({ selected, selectedFill, ink, rest }) {
|
|
1442
1447
|
if (!selected || selectedFill === void 0)
|
|
@@ -1444,10 +1449,14 @@ function chipFill({ selected, selectedFill, ink, rest }) {
|
|
|
1444
1449
|
return { backgroundColor: selectedFill, textColor: ink, checkColor: ink };
|
|
1445
1450
|
}
|
|
1446
1451
|
function chipSizeLook(size) {
|
|
1447
|
-
if (size
|
|
1452
|
+
if (!isCompactSize(size))
|
|
1448
1453
|
return { hitBox: void 0, visual: void 0, text: void 0 };
|
|
1449
1454
|
return { hitBox: chipSizeStyles.compactHitBox, visual: chipSizeStyles.compactVisual, text: chipSizeStyles.compactText };
|
|
1450
1455
|
}
|
|
1456
|
+
var DENSE_ROW_GAP = { rowGap: 0 };
|
|
1457
|
+
function chipRowGap(size) {
|
|
1458
|
+
return size === "dense" ? DENSE_ROW_GAP : void 0;
|
|
1459
|
+
}
|
|
1451
1460
|
function restBorderColor(colors, tone) {
|
|
1452
1461
|
return tone === "strong" ? colors.borderStrong : colors.border;
|
|
1453
1462
|
}
|
|
@@ -1780,7 +1789,7 @@ var ChipSelector = ({
|
|
|
1780
1789
|
View,
|
|
1781
1790
|
{
|
|
1782
1791
|
accessibilityRole: isRadioGroup ? "radiogroup" : void 0,
|
|
1783
|
-
style: styles13.chipContainer,
|
|
1792
|
+
style: [styles13.chipContainer, chipRowGap(size)],
|
|
1784
1793
|
...webFieldA11y({ describedById, hasError }),
|
|
1785
1794
|
...radio.groupProps,
|
|
1786
1795
|
children: options.map(renderChip)
|
|
@@ -2115,11 +2124,18 @@ var NATIVE_SELECT_BOX = {
|
|
|
2115
2124
|
fontFamily: "inherit",
|
|
2116
2125
|
width: "100%"
|
|
2117
2126
|
};
|
|
2118
|
-
|
|
2127
|
+
var FIT_SELECT_BOX = { width: "auto", maxWidth: "none" };
|
|
2128
|
+
var fitStyles = StyleSheet.create({
|
|
2129
|
+
anchor: { alignSelf: "flex-start", flexShrink: 0 }
|
|
2130
|
+
});
|
|
2131
|
+
function nativeSelectBox(fit) {
|
|
2132
|
+
return fit ? { ...NATIVE_SELECT_BOX, ...FIT_SELECT_BOX } : NATIVE_SELECT_BOX;
|
|
2133
|
+
}
|
|
2134
|
+
function nativeSelectStyle(fit, borderColor, backgroundColor, color) {
|
|
2119
2135
|
const trigger = StyleSheet.flatten(controlStyles.selectTrigger);
|
|
2120
2136
|
const text = StyleSheet.flatten(controlStyles.selectTriggerText);
|
|
2121
2137
|
return {
|
|
2122
|
-
...
|
|
2138
|
+
...nativeSelectBox(fit),
|
|
2123
2139
|
minHeight: trigger.minHeight,
|
|
2124
2140
|
borderWidth: trigger.borderWidth,
|
|
2125
2141
|
borderRadius: trigger.borderRadius,
|
|
@@ -2140,20 +2156,22 @@ function NativeSelect({
|
|
|
2140
2156
|
accessibilityHint,
|
|
2141
2157
|
labelledById,
|
|
2142
2158
|
style,
|
|
2143
|
-
testID
|
|
2159
|
+
testID,
|
|
2160
|
+
native
|
|
2144
2161
|
}) {
|
|
2145
2162
|
const { theme } = useUi();
|
|
2146
2163
|
const { colors } = theme;
|
|
2147
2164
|
const hasMatch = options.some((o) => o.value === value);
|
|
2148
2165
|
const textColor = hasMatch ? colors.text : colors.textSecondary;
|
|
2166
|
+
const fit = native === "fit";
|
|
2149
2167
|
const handleChange = (event) => onChange(event.target.value);
|
|
2150
|
-
return /* @__PURE__ */ jsx(View, { style: [controlStyles.anchor, style], children: /* @__PURE__ */ jsxs(
|
|
2168
|
+
return /* @__PURE__ */ jsx(View, { style: [controlStyles.anchor, fit ? fitStyles.anchor : void 0, style], children: /* @__PURE__ */ jsxs(
|
|
2151
2169
|
"select",
|
|
2152
2170
|
{
|
|
2153
2171
|
"aria-label": accessibilityLabel,
|
|
2154
2172
|
"aria-labelledby": labelledById,
|
|
2155
2173
|
"data-testid": testID,
|
|
2156
|
-
style: nativeSelectStyle(colors.border, colors.surfaceElevated, textColor),
|
|
2174
|
+
style: nativeSelectStyle(fit, colors.border, colors.surfaceElevated, textColor),
|
|
2157
2175
|
title: accessibilityHint,
|
|
2158
2176
|
value,
|
|
2159
2177
|
onChange: handleChange,
|
|
@@ -2207,7 +2225,7 @@ function listboxTriggerAria(testID, hasList, highlighted) {
|
|
|
2207
2225
|
};
|
|
2208
2226
|
}
|
|
2209
2227
|
function SelectControl(props) {
|
|
2210
|
-
return props.native === true && IS_WEB7 ? /* @__PURE__ */ jsx(NativeSelect, { ...props }) : /* @__PURE__ */ jsx(MenuSelectControl, { ...props });
|
|
2228
|
+
return (props.native === true || props.native === "fit") && IS_WEB7 ? /* @__PURE__ */ jsx(NativeSelect, { ...props }) : /* @__PURE__ */ jsx(MenuSelectControl, { ...props });
|
|
2211
2229
|
}
|
|
2212
2230
|
function MenuSelectControl({
|
|
2213
2231
|
options,
|