@dloizides/ui-forms 1.34.1 → 1.36.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 +1 -0
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +39 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1195,6 +1195,26 @@ 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/ChipLabelWrap.ts
|
|
1200
|
+
var ChipLabelWrap = /* @__PURE__ */ ((ChipLabelWrap2) => {
|
|
1201
|
+
ChipLabelWrap2["None"] = "none";
|
|
1202
|
+
ChipLabelWrap2["Wrap"] = "wrap";
|
|
1203
|
+
ChipLabelWrap2["Truncate"] = "truncate";
|
|
1204
|
+
return ChipLabelWrap2;
|
|
1205
|
+
})(ChipLabelWrap || {});
|
|
1206
|
+
|
|
1207
|
+
// src/ChipSelector/utils/chipLabelLayout.ts
|
|
1208
|
+
var CAPPED_BOX = { maxWidth: "100%", flexShrink: 1 };
|
|
1209
|
+
var SHRINKING_TEXT = { flexShrink: 1 };
|
|
1210
|
+
var SINGLE_LINE = 1;
|
|
1211
|
+
function chipLabelLayout(labelWrap) {
|
|
1212
|
+
if (labelWrap === "wrap" /* Wrap */)
|
|
1213
|
+
return { boxStyle: CAPPED_BOX, textStyle: SHRINKING_TEXT, numberOfLines: void 0 };
|
|
1214
|
+
if (labelWrap === "truncate" /* Truncate */)
|
|
1215
|
+
return { boxStyle: CAPPED_BOX, textStyle: SHRINKING_TEXT, numberOfLines: SINGLE_LINE };
|
|
1216
|
+
return { boxStyle: void 0, textStyle: void 0, numberOfLines: void 0 };
|
|
1217
|
+
}
|
|
1198
1218
|
var SOLID_RADIUS = 20;
|
|
1199
1219
|
var OUTLINE_RADIUS = 999;
|
|
1200
1220
|
var OUTLINE_PAD_H = 12;
|
|
@@ -1226,8 +1246,8 @@ var chipStyles = StyleSheet.create({
|
|
|
1226
1246
|
chipText: {},
|
|
1227
1247
|
chipTextOutline: { fontSize: OUTLINE_FONT_SIZE }
|
|
1228
1248
|
});
|
|
1229
|
-
function ChipContent({ icon, label, textStyle }) {
|
|
1230
|
-
const text = /* @__PURE__ */ jsx(Text, { style: textStyle, children: label });
|
|
1249
|
+
function ChipContent({ icon, label, textStyle, numberOfLines }) {
|
|
1250
|
+
const text = /* @__PURE__ */ jsx(Text, { numberOfLines, style: textStyle, children: label });
|
|
1231
1251
|
if (icon === void 0 || icon === null)
|
|
1232
1252
|
return text;
|
|
1233
1253
|
return /* @__PURE__ */ jsxs(View, { style: chipStyles.chipContent, children: [
|
|
@@ -1242,6 +1262,7 @@ function OutlineChip(props) {
|
|
|
1242
1262
|
const borderColor = active ? colors.primary : colors.border;
|
|
1243
1263
|
const backgroundColor = selected ? colors.tint : colors.muted;
|
|
1244
1264
|
const textColor = active ? colors.primary : colors.textMuted;
|
|
1265
|
+
const layout = chipLabelLayout(option.labelWrap);
|
|
1245
1266
|
return /* @__PURE__ */ jsx(
|
|
1246
1267
|
Pressable,
|
|
1247
1268
|
{
|
|
@@ -1254,17 +1275,19 @@ function OutlineChip(props) {
|
|
|
1254
1275
|
"aria-pressed": props.ariaPressed,
|
|
1255
1276
|
disabled,
|
|
1256
1277
|
hitSlop: CHIP_HIT_SLOP,
|
|
1278
|
+
style: layout.boxStyle,
|
|
1257
1279
|
tabIndex: props.tabIndex,
|
|
1258
1280
|
testID,
|
|
1259
1281
|
onHoverIn: () => setHovered(true),
|
|
1260
1282
|
onHoverOut: () => setHovered(false),
|
|
1261
1283
|
onPress,
|
|
1262
|
-
children: /* @__PURE__ */ jsx(View, { style: [chipStyles.chipOutline, { borderColor, backgroundColor }], children: /* @__PURE__ */ jsx(
|
|
1284
|
+
children: /* @__PURE__ */ jsx(View, { style: [chipStyles.chipOutline, { borderColor, backgroundColor }, layout.boxStyle], children: /* @__PURE__ */ jsx(
|
|
1263
1285
|
ChipContent,
|
|
1264
1286
|
{
|
|
1265
1287
|
icon: option.icon,
|
|
1266
1288
|
label: option.label,
|
|
1267
|
-
|
|
1289
|
+
numberOfLines: layout.numberOfLines,
|
|
1290
|
+
textStyle: [chipStyles.chipText, chipStyles.chipTextOutline, { color: textColor }, layout.textStyle]
|
|
1268
1291
|
}
|
|
1269
1292
|
) })
|
|
1270
1293
|
}
|
|
@@ -1274,6 +1297,7 @@ function SolidChip(props) {
|
|
|
1274
1297
|
const { option, selected, disabled, colors, testID, accessibilityHint, onPress } = props;
|
|
1275
1298
|
const backgroundColor = selected ? colors.primary : TRANSPARENT_COLOR;
|
|
1276
1299
|
const textColor = selected ? colors.onPrimary : colors.textStrong;
|
|
1300
|
+
const layout = chipLabelLayout(option.labelWrap);
|
|
1277
1301
|
const rovingTabStop = { tabIndex: props.tabIndex };
|
|
1278
1302
|
return /* @__PURE__ */ jsx(
|
|
1279
1303
|
TouchableOpacity,
|
|
@@ -1287,10 +1311,19 @@ function SolidChip(props) {
|
|
|
1287
1311
|
"aria-pressed": props.ariaPressed,
|
|
1288
1312
|
disabled,
|
|
1289
1313
|
hitSlop: CHIP_HIT_SLOP,
|
|
1314
|
+
style: layout.boxStyle,
|
|
1290
1315
|
testID,
|
|
1291
1316
|
onPress,
|
|
1292
1317
|
...rovingTabStop,
|
|
1293
|
-
children: /* @__PURE__ */ jsx(View, { style: [chipStyles.chip, { borderColor: colors.border, backgroundColor }], children: /* @__PURE__ */ jsx(
|
|
1318
|
+
children: /* @__PURE__ */ jsx(View, { style: [chipStyles.chip, { borderColor: colors.border, backgroundColor }, layout.boxStyle], children: /* @__PURE__ */ jsx(
|
|
1319
|
+
ChipContent,
|
|
1320
|
+
{
|
|
1321
|
+
icon: option.icon,
|
|
1322
|
+
label: option.label,
|
|
1323
|
+
numberOfLines: layout.numberOfLines,
|
|
1324
|
+
textStyle: [chipStyles.chipText, { color: textColor }, layout.textStyle]
|
|
1325
|
+
}
|
|
1326
|
+
) })
|
|
1294
1327
|
}
|
|
1295
1328
|
);
|
|
1296
1329
|
}
|
|
@@ -4047,6 +4080,6 @@ function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilit
|
|
|
4047
4080
|
] });
|
|
4048
4081
|
}
|
|
4049
4082
|
|
|
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 };
|
|
4083
|
+
export { AddOnRequest, AlignToControl, AnchoredMenu, BicInput, BicRejection, COUNTRIES, ChipLabelWrap, 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 };
|
|
4051
4084
|
//# sourceMappingURL=index.mjs.map
|
|
4052
4085
|
//# sourceMappingURL=index.mjs.map
|