@dloizides/ui-forms 1.25.0 → 1.26.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,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.26.0
4
+
5
+ INVOICE-3 "Invoice interface over a user-chosen folder": owner picks.
6
+
7
+ - `SelectControl` trigger fills with `surfaceElevated`, like an editable field, so it differs from read-only.
8
+ - Read-only `useThemedInput` draws the rest border, so the box shows on a form of the same fill.
9
+ - Placeholder is solid `textSecondary`: 0.6 alpha measured 2.38 against the 4.5 AA floor.
10
+ - `FormField` gains `inputRef`.
11
+
3
12
  ## 1.25.0
4
13
 
5
14
  INVOICE-3 "Invoice interface over a user-chosen folder": extracted from invoice-web.
package/dist/index.d.mts CHANGED
@@ -438,8 +438,10 @@ interface FormFieldProps extends Omit<TextInputProps, 'style'> {
438
438
  recentKey?: string;
439
439
  /** Cap on remembered values when {@link recentKey} is set (most-recent-first). Default 10. */
440
440
  recentMax?: number;
441
+ /** Reaches the input, for focusing it without scrolling the page. Not forwarded when `recentKey` is set. */
442
+ inputRef?: React.Ref<TextInput>;
441
443
  }
442
- declare const FormField: ({ label, labelHidden, required, error, containerStyle, recentKey, recentMax, ...textInputProps }: FormFieldProps) => React.ReactElement;
444
+ declare const FormField: ({ label, labelHidden, required, error, containerStyle, recentKey, recentMax, inputRef, ...textInputProps }: FormFieldProps) => React.ReactElement;
443
445
 
444
446
  /**
445
447
  * `ThemedTextInput` — the shared, readable + lively text-input primitive. A thin `<TextInput>`
@@ -501,7 +503,7 @@ interface UseThemedInputOptions {
501
503
  onFocus?: (e: FocusEvent) => void;
502
504
  /** Consumer blur handler — composed with the internal focus-state toggle. */
503
505
  onBlur?: (e: BlurEvent) => void;
504
- /** `false` renders the read-only treatment: the recessed ground fill and the secondary ink. */
506
+ /** `false` renders the read-only treatment: flat surface fill, no input outline, secondary ink. */
505
507
  editable?: boolean;
506
508
  }
507
509
  interface ThemedInput {
package/dist/index.d.ts CHANGED
@@ -438,8 +438,10 @@ interface FormFieldProps extends Omit<TextInputProps, 'style'> {
438
438
  recentKey?: string;
439
439
  /** Cap on remembered values when {@link recentKey} is set (most-recent-first). Default 10. */
440
440
  recentMax?: number;
441
+ /** Reaches the input, for focusing it without scrolling the page. Not forwarded when `recentKey` is set. */
442
+ inputRef?: React.Ref<TextInput>;
441
443
  }
442
- declare const FormField: ({ label, labelHidden, required, error, containerStyle, recentKey, recentMax, ...textInputProps }: FormFieldProps) => React.ReactElement;
444
+ declare const FormField: ({ label, labelHidden, required, error, containerStyle, recentKey, recentMax, inputRef, ...textInputProps }: FormFieldProps) => React.ReactElement;
443
445
 
444
446
  /**
445
447
  * `ThemedTextInput` — the shared, readable + lively text-input primitive. A thin `<TextInput>`
@@ -501,7 +503,7 @@ interface UseThemedInputOptions {
501
503
  onFocus?: (e: FocusEvent) => void;
502
504
  /** Consumer blur handler — composed with the internal focus-state toggle. */
503
505
  onBlur?: (e: BlurEvent) => void;
504
- /** `false` renders the read-only treatment: the recessed ground fill and the secondary ink. */
506
+ /** `false` renders the read-only treatment: flat surface fill, no input outline, secondary ink. */
505
507
  editable?: boolean;
506
508
  }
507
509
  interface ThemedInput {
package/dist/index.js CHANGED
@@ -813,7 +813,6 @@ var TRANSITION_DURATION = "0.14s";
813
813
  var TRANSITION_TIMING = "ease";
814
814
  var NO_RING = { outlineWidth: 0 };
815
815
  var HOVER_BORDER_ALPHA = 0.22;
816
- var PLACEHOLDER_ALPHA = 0.6;
817
816
  var HEX_RADIX = 16;
818
817
  var HEX_SHORT_LENGTH = 4;
819
818
  var HEX_FULL_LENGTH = 7;
@@ -862,9 +861,10 @@ function useThemedInput(options = {}) {
862
861
  const style = React2.useMemo(() => {
863
862
  const restBorder = hasError ? errorColor : colors.border;
864
863
  const focusBorder = hasError ? errorColor : primary;
865
- const borderColor = isFocused ? focusBorder : isHovered ? withAlpha(colors.text, HOVER_BORDER_ALPHA) : restBorder;
864
+ const editableBorder = isFocused ? focusBorder : isHovered ? withAlpha(colors.text, HOVER_BORDER_ALPHA) : restBorder;
865
+ const borderColor = editable ? editableBorder : restBorder;
866
866
  const editableFill = isFocused ? colors.surface : colors.surfaceElevated;
867
- const backgroundColor = editable ? editableFill : colors.background;
867
+ const backgroundColor = editable ? editableFill : colors.surface;
868
868
  const base = { color: editable ? colors.text : colors.textSecondary, borderColor, backgroundColor };
869
869
  if (!IS_WEB5) return base;
870
870
  const ringColor = hasError ? errorColor : uiButtons.themeFocusRingColor(theme);
@@ -899,7 +899,7 @@ function useThemedInput(options = {}) {
899
899
  );
900
900
  return {
901
901
  style,
902
- placeholderTextColor: withAlpha(colors.textSecondary, PLACEHOLDER_ALPHA),
902
+ placeholderTextColor: colors.textSecondary,
903
903
  isFocused,
904
904
  isHovered,
905
905
  focusBind,
@@ -1142,6 +1142,7 @@ var FormField = ({
1142
1142
  containerStyle,
1143
1143
  recentKey,
1144
1144
  recentMax,
1145
+ inputRef,
1145
1146
  ...textInputProps
1146
1147
  }) => /* @__PURE__ */ jsxRuntime.jsx(
1147
1148
  Field,
@@ -1161,7 +1162,7 @@ var FormField = ({
1161
1162
  testID: "form-field-input",
1162
1163
  ...textInputProps
1163
1164
  };
1164
- return recentKey !== void 0 && recentKey !== "" ? /* @__PURE__ */ jsxRuntime.jsx(RecentInputField, { label, recentKey, recentMax, ...inputProps }) : /* @__PURE__ */ jsxRuntime.jsx(ThemedTextInput, { ...inputProps });
1165
+ return recentKey !== void 0 && recentKey !== "" ? /* @__PURE__ */ jsxRuntime.jsx(RecentInputField, { label, recentKey, recentMax, ...inputProps }) : /* @__PURE__ */ jsxRuntime.jsx(ThemedTextInput, { ref: inputRef, ...inputProps });
1165
1166
  }
1166
1167
  }
1167
1168
  );
@@ -1742,7 +1743,7 @@ function SelectControl({
1742
1743
  "aria-expanded": isOpen,
1743
1744
  "aria-labelledby": labelledById,
1744
1745
  onPress: toggle,
1745
- style: [controlStyles.selectTrigger, { borderColor: colors.border, backgroundColor: colors.surface }],
1746
+ style: [controlStyles.selectTrigger, { borderColor: colors.border, backgroundColor: colors.surfaceElevated }],
1746
1747
  testID: `${testID}-trigger`,
1747
1748
  children: [
1748
1749
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [controlStyles.selectTriggerText, { color: value === "" ? colors.textSecondary : colors.text }], children: selectedLabel }),