@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 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` = today's 44 px pill; `compact` = a 28 px pill inside a 44 px hit box. */
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 (44 px row pitch). */
664
+ type ChipSize = 'default' | 'compact' | 'dense';
665
665
 
666
666
  /**
667
667
  * Public + internal types for ChipSelector. Split out of `ChipSelector.tsx` so the component, its
@@ -731,7 +731,7 @@ interface ChipSelectorProps<T> {
731
731
  * stays a toggle button with `aria-pressed`.
732
732
  */
733
733
  singleSelectRole?: ChipSingleSelectRole;
734
- /** `compact` = a 28 px pill (padding 4/10, label 12/600) inside a 44 px hit box; defaults to `default`. */
734
+ /** `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
735
  size?: ChipSize;
736
736
  /** Background of a selected chip, from the app's tokens; when set, a selected chip also shows a leading check. */
737
737
  selectedFill?: string;
@@ -888,8 +888,8 @@ interface SelectControlProps {
888
888
  style?: StyleProp<ViewStyle>;
889
889
  /** Trigger is `${testID}-trigger`, menu `${testID}-menu`, options `${testID}-option-${value}`. */
890
890
  testID: string;
891
- /** Web only: render a real `<select>` (the select carries the plain `testID`); ignored off web. */
892
- native?: boolean;
891
+ /** Web only: render a real `<select>` (plain `testID`); `'fit'` sizes it to its longest option instead of the full width. */
892
+ native?: boolean | 'fit';
893
893
  }
894
894
  declare function SelectControl(props: SelectControlProps): React.ReactElement;
895
895
 
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` = today's 44 px pill; `compact` = a 28 px pill inside a 44 px hit box. */
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 (44 px row pitch). */
664
+ type ChipSize = 'default' | 'compact' | 'dense';
665
665
 
666
666
  /**
667
667
  * Public + internal types for ChipSelector. Split out of `ChipSelector.tsx` so the component, its
@@ -731,7 +731,7 @@ interface ChipSelectorProps<T> {
731
731
  * stays a toggle button with `aria-pressed`.
732
732
  */
733
733
  singleSelectRole?: ChipSingleSelectRole;
734
- /** `compact` = a 28 px pill (padding 4/10, label 12/600) inside a 44 px hit box; defaults to `default`. */
734
+ /** `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
735
  size?: ChipSize;
736
736
  /** Background of a selected chip, from the app's tokens; when set, a selected chip also shows a leading check. */
737
737
  selectedFill?: string;
@@ -888,8 +888,8 @@ interface SelectControlProps {
888
888
  style?: StyleProp<ViewStyle>;
889
889
  /** Trigger is `${testID}-trigger`, menu `${testID}-menu`, options `${testID}-option-${value}`. */
890
890
  testID: string;
891
- /** Web only: render a real `<select>` (the select carries the plain `testID`); ignored off web. */
892
- native?: boolean;
891
+ /** Web only: render a real `<select>` (plain `testID`); `'fit'` sizes it to its longest option instead of the full width. */
892
+ native?: boolean | 'fit';
893
893
  }
894
894
  declare function SelectControl(props: SelectControlProps): React.ReactElement;
895
895
 
package/dist/index.js CHANGED
@@ -1444,6 +1444,11 @@ var chipSizeStyles = reactNative.StyleSheet.create({
1444
1444
  }
1445
1445
  });
1446
1446
 
1447
+ // src/ChipSelector/ChipSize.ts
1448
+ function isCompactSize(size) {
1449
+ return size === "compact" || size === "dense";
1450
+ }
1451
+
1447
1452
  // src/ChipSelector/utils/chipLook.ts
1448
1453
  function chipFill({ selected, selectedFill, ink, rest }) {
1449
1454
  if (!selected || selectedFill === void 0)
@@ -1451,10 +1456,14 @@ function chipFill({ selected, selectedFill, ink, rest }) {
1451
1456
  return { backgroundColor: selectedFill, textColor: ink, checkColor: ink };
1452
1457
  }
1453
1458
  function chipSizeLook(size) {
1454
- if (size !== "compact")
1459
+ if (!isCompactSize(size))
1455
1460
  return { hitBox: void 0, visual: void 0, text: void 0 };
1456
1461
  return { hitBox: chipSizeStyles.compactHitBox, visual: chipSizeStyles.compactVisual, text: chipSizeStyles.compactText };
1457
1462
  }
1463
+ var DENSE_ROW_GAP = { rowGap: 0 };
1464
+ function chipRowGap(size) {
1465
+ return size === "dense" ? DENSE_ROW_GAP : void 0;
1466
+ }
1458
1467
  function restBorderColor(colors, tone) {
1459
1468
  return tone === "strong" ? colors.borderStrong : colors.border;
1460
1469
  }
@@ -1787,7 +1796,7 @@ var ChipSelector = ({
1787
1796
  reactNative.View,
1788
1797
  {
1789
1798
  accessibilityRole: isRadioGroup ? "radiogroup" : void 0,
1790
- style: styles13.chipContainer,
1799
+ style: [styles13.chipContainer, chipRowGap(size)],
1791
1800
  ...webFieldA11y({ describedById, hasError }),
1792
1801
  ...radio.groupProps,
1793
1802
  children: options.map(renderChip)
@@ -2122,11 +2131,18 @@ var NATIVE_SELECT_BOX = {
2122
2131
  fontFamily: "inherit",
2123
2132
  width: "100%"
2124
2133
  };
2125
- function nativeSelectStyle(borderColor, backgroundColor, color) {
2134
+ var FIT_SELECT_BOX = { width: "auto", maxWidth: "none" };
2135
+ var fitStyles = reactNative.StyleSheet.create({
2136
+ anchor: { alignSelf: "flex-start", flexShrink: 0 }
2137
+ });
2138
+ function nativeSelectBox(fit) {
2139
+ return fit ? { ...NATIVE_SELECT_BOX, ...FIT_SELECT_BOX } : NATIVE_SELECT_BOX;
2140
+ }
2141
+ function nativeSelectStyle(fit, borderColor, backgroundColor, color) {
2126
2142
  const trigger = reactNative.StyleSheet.flatten(controlStyles.selectTrigger);
2127
2143
  const text = reactNative.StyleSheet.flatten(controlStyles.selectTriggerText);
2128
2144
  return {
2129
- ...NATIVE_SELECT_BOX,
2145
+ ...nativeSelectBox(fit),
2130
2146
  minHeight: trigger.minHeight,
2131
2147
  borderWidth: trigger.borderWidth,
2132
2148
  borderRadius: trigger.borderRadius,
@@ -2147,20 +2163,22 @@ function NativeSelect({
2147
2163
  accessibilityHint,
2148
2164
  labelledById,
2149
2165
  style,
2150
- testID
2166
+ testID,
2167
+ native
2151
2168
  }) {
2152
2169
  const { theme } = uiFeedback.useUi();
2153
2170
  const { colors } = theme;
2154
2171
  const hasMatch = options.some((o) => o.value === value);
2155
2172
  const textColor = hasMatch ? colors.text : colors.textSecondary;
2173
+ const fit = native === "fit";
2156
2174
  const handleChange = (event) => onChange(event.target.value);
2157
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [controlStyles.anchor, style], children: /* @__PURE__ */ jsxRuntime.jsxs(
2175
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [controlStyles.anchor, fit ? fitStyles.anchor : void 0, style], children: /* @__PURE__ */ jsxRuntime.jsxs(
2158
2176
  "select",
2159
2177
  {
2160
2178
  "aria-label": accessibilityLabel,
2161
2179
  "aria-labelledby": labelledById,
2162
2180
  "data-testid": testID,
2163
- style: nativeSelectStyle(colors.border, colors.surfaceElevated, textColor),
2181
+ style: nativeSelectStyle(fit, colors.border, colors.surfaceElevated, textColor),
2164
2182
  title: accessibilityHint,
2165
2183
  value,
2166
2184
  onChange: handleChange,
@@ -2214,7 +2232,7 @@ function listboxTriggerAria(testID, hasList, highlighted) {
2214
2232
  };
2215
2233
  }
2216
2234
  function SelectControl(props) {
2217
- return props.native === true && IS_WEB7 ? /* @__PURE__ */ jsxRuntime.jsx(NativeSelect, { ...props }) : /* @__PURE__ */ jsxRuntime.jsx(MenuSelectControl, { ...props });
2235
+ return (props.native === true || props.native === "fit") && IS_WEB7 ? /* @__PURE__ */ jsxRuntime.jsx(NativeSelect, { ...props }) : /* @__PURE__ */ jsxRuntime.jsx(MenuSelectControl, { ...props });
2218
2236
  }
2219
2237
  function MenuSelectControl({
2220
2238
  options,