@dloizides/ui-forms 1.34.1 → 1.35.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 +533 -532
- package/dist/index.d.mts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +31 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1195,6 +1195,18 @@ var TRANSPARENT_COLOR = "transparent";
|
|
|
1195
1195
|
var CHIP_HIT_SLOP = { top: 10, bottom: 10, left: 4, right: 4 };
|
|
1196
1196
|
var CHIP_GUTTER = 8;
|
|
1197
1197
|
var DEFAULT_CHIP_TESTID_PREFIX = "chip-selector-chip";
|
|
1198
|
+
|
|
1199
|
+
// src/ChipSelector/utils/chipLabelLayout.ts
|
|
1200
|
+
var CAPPED_BOX = { maxWidth: "100%", flexShrink: 1 };
|
|
1201
|
+
var SHRINKING_TEXT = { flexShrink: 1 };
|
|
1202
|
+
var SINGLE_LINE = 1;
|
|
1203
|
+
function chipLabelLayout(labelWrap) {
|
|
1204
|
+
if (labelWrap === "wrap")
|
|
1205
|
+
return { boxStyle: CAPPED_BOX, textStyle: SHRINKING_TEXT, numberOfLines: void 0 };
|
|
1206
|
+
if (labelWrap === "truncate")
|
|
1207
|
+
return { boxStyle: CAPPED_BOX, textStyle: SHRINKING_TEXT, numberOfLines: SINGLE_LINE };
|
|
1208
|
+
return { boxStyle: void 0, textStyle: void 0, numberOfLines: void 0 };
|
|
1209
|
+
}
|
|
1198
1210
|
var SOLID_RADIUS = 20;
|
|
1199
1211
|
var OUTLINE_RADIUS = 999;
|
|
1200
1212
|
var OUTLINE_PAD_H = 12;
|
|
@@ -1226,8 +1238,8 @@ var chipStyles = StyleSheet.create({
|
|
|
1226
1238
|
chipText: {},
|
|
1227
1239
|
chipTextOutline: { fontSize: OUTLINE_FONT_SIZE }
|
|
1228
1240
|
});
|
|
1229
|
-
function ChipContent({ icon, label, textStyle }) {
|
|
1230
|
-
const text = /* @__PURE__ */ jsx(Text, { style: textStyle, children: label });
|
|
1241
|
+
function ChipContent({ icon, label, textStyle, numberOfLines }) {
|
|
1242
|
+
const text = /* @__PURE__ */ jsx(Text, { numberOfLines, style: textStyle, children: label });
|
|
1231
1243
|
if (icon === void 0 || icon === null)
|
|
1232
1244
|
return text;
|
|
1233
1245
|
return /* @__PURE__ */ jsxs(View, { style: chipStyles.chipContent, children: [
|
|
@@ -1242,6 +1254,7 @@ function OutlineChip(props) {
|
|
|
1242
1254
|
const borderColor = active ? colors.primary : colors.border;
|
|
1243
1255
|
const backgroundColor = selected ? colors.tint : colors.muted;
|
|
1244
1256
|
const textColor = active ? colors.primary : colors.textMuted;
|
|
1257
|
+
const layout = chipLabelLayout(option.labelWrap);
|
|
1245
1258
|
return /* @__PURE__ */ jsx(
|
|
1246
1259
|
Pressable,
|
|
1247
1260
|
{
|
|
@@ -1254,17 +1267,19 @@ function OutlineChip(props) {
|
|
|
1254
1267
|
"aria-pressed": props.ariaPressed,
|
|
1255
1268
|
disabled,
|
|
1256
1269
|
hitSlop: CHIP_HIT_SLOP,
|
|
1270
|
+
style: layout.boxStyle,
|
|
1257
1271
|
tabIndex: props.tabIndex,
|
|
1258
1272
|
testID,
|
|
1259
1273
|
onHoverIn: () => setHovered(true),
|
|
1260
1274
|
onHoverOut: () => setHovered(false),
|
|
1261
1275
|
onPress,
|
|
1262
|
-
children: /* @__PURE__ */ jsx(View, { style: [chipStyles.chipOutline, { borderColor, backgroundColor }], children: /* @__PURE__ */ jsx(
|
|
1276
|
+
children: /* @__PURE__ */ jsx(View, { style: [chipStyles.chipOutline, { borderColor, backgroundColor }, layout.boxStyle], children: /* @__PURE__ */ jsx(
|
|
1263
1277
|
ChipContent,
|
|
1264
1278
|
{
|
|
1265
1279
|
icon: option.icon,
|
|
1266
1280
|
label: option.label,
|
|
1267
|
-
|
|
1281
|
+
numberOfLines: layout.numberOfLines,
|
|
1282
|
+
textStyle: [chipStyles.chipText, chipStyles.chipTextOutline, { color: textColor }, layout.textStyle]
|
|
1268
1283
|
}
|
|
1269
1284
|
) })
|
|
1270
1285
|
}
|
|
@@ -1274,6 +1289,7 @@ function SolidChip(props) {
|
|
|
1274
1289
|
const { option, selected, disabled, colors, testID, accessibilityHint, onPress } = props;
|
|
1275
1290
|
const backgroundColor = selected ? colors.primary : TRANSPARENT_COLOR;
|
|
1276
1291
|
const textColor = selected ? colors.onPrimary : colors.textStrong;
|
|
1292
|
+
const layout = chipLabelLayout(option.labelWrap);
|
|
1277
1293
|
const rovingTabStop = { tabIndex: props.tabIndex };
|
|
1278
1294
|
return /* @__PURE__ */ jsx(
|
|
1279
1295
|
TouchableOpacity,
|
|
@@ -1287,10 +1303,19 @@ function SolidChip(props) {
|
|
|
1287
1303
|
"aria-pressed": props.ariaPressed,
|
|
1288
1304
|
disabled,
|
|
1289
1305
|
hitSlop: CHIP_HIT_SLOP,
|
|
1306
|
+
style: layout.boxStyle,
|
|
1290
1307
|
testID,
|
|
1291
1308
|
onPress,
|
|
1292
1309
|
...rovingTabStop,
|
|
1293
|
-
children: /* @__PURE__ */ jsx(View, { style: [chipStyles.chip, { borderColor: colors.border, backgroundColor }], children: /* @__PURE__ */ jsx(
|
|
1310
|
+
children: /* @__PURE__ */ jsx(View, { style: [chipStyles.chip, { borderColor: colors.border, backgroundColor }, layout.boxStyle], children: /* @__PURE__ */ jsx(
|
|
1311
|
+
ChipContent,
|
|
1312
|
+
{
|
|
1313
|
+
icon: option.icon,
|
|
1314
|
+
label: option.label,
|
|
1315
|
+
numberOfLines: layout.numberOfLines,
|
|
1316
|
+
textStyle: [chipStyles.chipText, { color: textColor }, layout.textStyle]
|
|
1317
|
+
}
|
|
1318
|
+
) })
|
|
1294
1319
|
}
|
|
1295
1320
|
);
|
|
1296
1321
|
}
|
|
@@ -4047,6 +4072,6 @@ function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilit
|
|
|
4047
4072
|
] });
|
|
4048
4073
|
}
|
|
4049
4074
|
|
|
4050
|
-
export { AddOnRequest, AlignToControl, AnchoredMenu, BicInput, BicRejection, COUNTRIES, ChipSelector, CountryField, CountryFlag, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateField, DateInput, DateRangeControl, DateTimeField, DropdownPlacement, FLAG_HEIGHT, FLAG_WIDTH, Field, FixBar, FlagShapeKind, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormStack, FormStatusLine, FormSwitch, IBAN_MAX_LENGTH, IBAN_REGISTERED_COUNTRY_COUNT, INLINE_FIELD_ROW_MIN_WIDTH, IbanInput, IbanRejection, InlineFieldRow, PHONE_MAX_WIDTH, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, ResponsiveFormLayout, SearchSelect, SelectControl, SelectField, SelectSurface, StepperNav, StepperTabs, ThemedTextInput, TypeaheadControl, UploadWithLinkField, buildSearchSelectSections, controlStyles, countryFlag, countryOptions, draftBic, draftIban, dropdownFrame, findOption, flagShapes, groupAriaChecked, groupInFours, highlightAfterQuery, ibanCounter, ibanLengthFor, inlineFieldRowLayout, isAddOnOpen, isFallbackFlag, isFixBarVisible, isOutside, isUnmatched, isWideFormLayout, moveHighlight, nextHighlight, placeDropdown, rejectionMessage, resolveGroupSelection, resolveSelectMotion, resolveStepNeighbours, suggestOptions, toCountryValue, toggleGroupSelection, useBlurVerdict, useDeferredFocus, useFocusFirstInvalid, useKeepInView, useOutsidePress, useRecentValues, useReducedMotion, useSearchSelectState, useThemedInput, validateBic, validateIban };
|
|
4075
|
+
export { AddOnRequest, AlignToControl, AnchoredMenu, BicInput, BicRejection, COUNTRIES, ChipSelector, CountryField, CountryFlag, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateField, DateInput, DateRangeControl, DateTimeField, DropdownPlacement, FLAG_HEIGHT, FLAG_WIDTH, Field, FixBar, FlagShapeKind, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormStack, FormStatusLine, FormSwitch, IBAN_MAX_LENGTH, IBAN_REGISTERED_COUNTRY_COUNT, INLINE_FIELD_ROW_MIN_WIDTH, IbanInput, IbanRejection, InlineFieldRow, PHONE_MAX_WIDTH, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, ResponsiveFormLayout, SearchSelect, SelectControl, SelectField, SelectSurface, StepperNav, StepperTabs, ThemedTextInput, TypeaheadControl, UploadWithLinkField, buildSearchSelectSections, chipLabelLayout, controlStyles, countryFlag, countryOptions, draftBic, draftIban, dropdownFrame, findOption, flagShapes, groupAriaChecked, groupInFours, highlightAfterQuery, ibanCounter, ibanLengthFor, inlineFieldRowLayout, isAddOnOpen, isFallbackFlag, isFixBarVisible, isOutside, isUnmatched, isWideFormLayout, moveHighlight, nextHighlight, placeDropdown, rejectionMessage, resolveGroupSelection, resolveSelectMotion, resolveStepNeighbours, suggestOptions, toCountryValue, toggleGroupSelection, useBlurVerdict, useDeferredFocus, useFocusFirstInvalid, useKeepInView, useOutsidePress, useRecentValues, useReducedMotion, useSearchSelectState, useThemedInput, validateBic, validateIban };
|
|
4051
4076
|
//# sourceMappingURL=index.mjs.map
|
|
4052
4077
|
//# sourceMappingURL=index.mjs.map
|