@dloizides/ui-forms 1.24.0 → 1.25.1

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.25.0
4
+
5
+ INVOICE-3 "Invoice interface over a user-chosen folder": extracted from invoice-web.
6
+
7
+ - New `SelectField`: `Field` + `SelectControl`, its accessible name carries the selection.
8
+
3
9
  ## 1.24.0
4
10
 
5
11
  BEAD-3 "Report form: searchable pattern field": review fix.
package/dist/index.d.mts CHANGED
@@ -501,7 +501,7 @@ interface UseThemedInputOptions {
501
501
  onFocus?: (e: FocusEvent) => void;
502
502
  /** Consumer blur handler — composed with the internal focus-state toggle. */
503
503
  onBlur?: (e: BlurEvent) => void;
504
- /** `false` renders the read-only treatment: the recessed ground fill and the secondary ink. */
504
+ /** `false` renders the read-only treatment: flat surface fill, no input outline, secondary ink. */
505
505
  editable?: boolean;
506
506
  }
507
507
  interface ThemedInput {
@@ -762,6 +762,16 @@ interface SelectControlProps {
762
762
  }
763
763
  declare function SelectControl({ options, value, onChange, placeholder, accessibilityLabel, accessibilityHint, labelledById, optionHint, style, testID, }: SelectControlProps): React.ReactElement;
764
764
 
765
+ interface SelectFieldProps {
766
+ label: string;
767
+ accessibilityHint: string;
768
+ value: string;
769
+ options: readonly ControlOption[];
770
+ onChange: (value: string) => void;
771
+ testID: string;
772
+ }
773
+ declare const SelectField: ({ label, accessibilityHint, value, options, onChange, testID, }: SelectFieldProps) => React.ReactElement;
774
+
765
775
  interface FieldControlWiring {
766
776
  id?: string;
767
777
  describedById?: string;
@@ -1173,4 +1183,4 @@ interface UploadWithLinkFieldProps {
1173
1183
  /** An image field: preview, an upload control, and a link input revealed on request. */
1174
1184
  declare const UploadWithLinkField: ({ value, onChange, labels, uploadControl, testID, disabled, previewSize, }: UploadWithLinkFieldProps) => React.ReactElement;
1175
1185
 
1176
- export { AlignToControl, type AlignToControlProps, AnchoredMenu, type AnchoredMenuColors, type AnchoredMenuListbox, type AnchoredMenuProps, type ChipOption, ChipSelector, type ChipSelectorProps, type ChipSingleSelectRole, type ChipVariant, type ControlOption, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeControl, type DateRangeControlProps, type DateRangeValue, Field, type FieldChildContext, type FieldChildren, type FieldLabelVariant, type FieldMarker, type FieldProps, type FieldSpacing, type Focusable, type FocusableRefs, FormActions, type FormActionsProps, FormCell, type FormCellProps, FormCheckbox, type FormCheckboxProps, FormField, type FormFieldProps, FormGrid, type FormGridProps, FormSection, type FormSectionProps, FormStatusLine, type FormStatusLineProps, FormSwitch, type FormSwitchProps, type GroupSelection, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, type InlineFieldRowLayout, type InlineFieldRowProps, type RecentValues, SelectControl, type SelectControlProps, type StepNeighbours, StepperNav, type StepperNavLabels, type StepperNavProps, type StepperStep, StepperTabs, type StepperTabsProps, type ThemedInput, ThemedTextInput, type ThemedTextInputProps, TypeaheadControl, type TypeaheadControlProps, type TypeaheadSearch, type TypeaheadSearchProps, UploadWithLinkField, type UploadWithLinkFieldProps, type UploadWithLinkLabels, type UseThemedInputOptions, controlStyles, groupAriaChecked, inlineFieldRowLayout, isUnmatched, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
1186
+ export { AlignToControl, type AlignToControlProps, AnchoredMenu, type AnchoredMenuColors, type AnchoredMenuListbox, type AnchoredMenuProps, type ChipOption, ChipSelector, type ChipSelectorProps, type ChipSingleSelectRole, type ChipVariant, type ControlOption, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeControl, type DateRangeControlProps, type DateRangeValue, Field, type FieldChildContext, type FieldChildren, type FieldLabelVariant, type FieldMarker, type FieldProps, type FieldSpacing, type Focusable, type FocusableRefs, FormActions, type FormActionsProps, FormCell, type FormCellProps, FormCheckbox, type FormCheckboxProps, FormField, type FormFieldProps, FormGrid, type FormGridProps, FormSection, type FormSectionProps, FormStatusLine, type FormStatusLineProps, FormSwitch, type FormSwitchProps, type GroupSelection, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, type InlineFieldRowLayout, type InlineFieldRowProps, type RecentValues, SelectControl, type SelectControlProps, SelectField, type SelectFieldProps, type StepNeighbours, StepperNav, type StepperNavLabels, type StepperNavProps, type StepperStep, StepperTabs, type StepperTabsProps, type ThemedInput, ThemedTextInput, type ThemedTextInputProps, TypeaheadControl, type TypeaheadControlProps, type TypeaheadSearch, type TypeaheadSearchProps, UploadWithLinkField, type UploadWithLinkFieldProps, type UploadWithLinkLabels, type UseThemedInputOptions, controlStyles, groupAriaChecked, inlineFieldRowLayout, isUnmatched, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
package/dist/index.d.ts CHANGED
@@ -501,7 +501,7 @@ interface UseThemedInputOptions {
501
501
  onFocus?: (e: FocusEvent) => void;
502
502
  /** Consumer blur handler — composed with the internal focus-state toggle. */
503
503
  onBlur?: (e: BlurEvent) => void;
504
- /** `false` renders the read-only treatment: the recessed ground fill and the secondary ink. */
504
+ /** `false` renders the read-only treatment: flat surface fill, no input outline, secondary ink. */
505
505
  editable?: boolean;
506
506
  }
507
507
  interface ThemedInput {
@@ -762,6 +762,16 @@ interface SelectControlProps {
762
762
  }
763
763
  declare function SelectControl({ options, value, onChange, placeholder, accessibilityLabel, accessibilityHint, labelledById, optionHint, style, testID, }: SelectControlProps): React.ReactElement;
764
764
 
765
+ interface SelectFieldProps {
766
+ label: string;
767
+ accessibilityHint: string;
768
+ value: string;
769
+ options: readonly ControlOption[];
770
+ onChange: (value: string) => void;
771
+ testID: string;
772
+ }
773
+ declare const SelectField: ({ label, accessibilityHint, value, options, onChange, testID, }: SelectFieldProps) => React.ReactElement;
774
+
765
775
  interface FieldControlWiring {
766
776
  id?: string;
767
777
  describedById?: string;
@@ -1173,4 +1183,4 @@ interface UploadWithLinkFieldProps {
1173
1183
  /** An image field: preview, an upload control, and a link input revealed on request. */
1174
1184
  declare const UploadWithLinkField: ({ value, onChange, labels, uploadControl, testID, disabled, previewSize, }: UploadWithLinkFieldProps) => React.ReactElement;
1175
1185
 
1176
- export { AlignToControl, type AlignToControlProps, AnchoredMenu, type AnchoredMenuColors, type AnchoredMenuListbox, type AnchoredMenuProps, type ChipOption, ChipSelector, type ChipSelectorProps, type ChipSingleSelectRole, type ChipVariant, type ControlOption, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeControl, type DateRangeControlProps, type DateRangeValue, Field, type FieldChildContext, type FieldChildren, type FieldLabelVariant, type FieldMarker, type FieldProps, type FieldSpacing, type Focusable, type FocusableRefs, FormActions, type FormActionsProps, FormCell, type FormCellProps, FormCheckbox, type FormCheckboxProps, FormField, type FormFieldProps, FormGrid, type FormGridProps, FormSection, type FormSectionProps, FormStatusLine, type FormStatusLineProps, FormSwitch, type FormSwitchProps, type GroupSelection, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, type InlineFieldRowLayout, type InlineFieldRowProps, type RecentValues, SelectControl, type SelectControlProps, type StepNeighbours, StepperNav, type StepperNavLabels, type StepperNavProps, type StepperStep, StepperTabs, type StepperTabsProps, type ThemedInput, ThemedTextInput, type ThemedTextInputProps, TypeaheadControl, type TypeaheadControlProps, type TypeaheadSearch, type TypeaheadSearchProps, UploadWithLinkField, type UploadWithLinkFieldProps, type UploadWithLinkLabels, type UseThemedInputOptions, controlStyles, groupAriaChecked, inlineFieldRowLayout, isUnmatched, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
1186
+ export { AlignToControl, type AlignToControlProps, AnchoredMenu, type AnchoredMenuColors, type AnchoredMenuListbox, type AnchoredMenuProps, type ChipOption, ChipSelector, type ChipSelectorProps, type ChipSingleSelectRole, type ChipVariant, type ControlOption, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeControl, type DateRangeControlProps, type DateRangeValue, Field, type FieldChildContext, type FieldChildren, type FieldLabelVariant, type FieldMarker, type FieldProps, type FieldSpacing, type Focusable, type FocusableRefs, FormActions, type FormActionsProps, FormCell, type FormCellProps, FormCheckbox, type FormCheckboxProps, FormField, type FormFieldProps, FormGrid, type FormGridProps, FormSection, type FormSectionProps, FormStatusLine, type FormStatusLineProps, FormSwitch, type FormSwitchProps, type GroupSelection, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, type InlineFieldRowLayout, type InlineFieldRowProps, type RecentValues, SelectControl, type SelectControlProps, SelectField, type SelectFieldProps, type StepNeighbours, StepperNav, type StepperNavLabels, type StepperNavProps, type StepperStep, StepperTabs, type StepperTabsProps, type ThemedInput, ThemedTextInput, type ThemedTextInputProps, TypeaheadControl, type TypeaheadControlProps, type TypeaheadSearch, type TypeaheadSearchProps, UploadWithLinkField, type UploadWithLinkFieldProps, type UploadWithLinkLabels, type UseThemedInputOptions, controlStyles, groupAriaChecked, inlineFieldRowLayout, isUnmatched, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
package/dist/index.js CHANGED
@@ -862,9 +862,11 @@ function useThemedInput(options = {}) {
862
862
  const style = React2.useMemo(() => {
863
863
  const restBorder = hasError ? errorColor : colors.border;
864
864
  const focusBorder = hasError ? errorColor : primary;
865
- const borderColor = isFocused ? focusBorder : isHovered ? withAlpha(colors.text, HOVER_BORDER_ALPHA) : restBorder;
865
+ const editableBorder = isFocused ? focusBorder : isHovered ? withAlpha(colors.text, HOVER_BORDER_ALPHA) : restBorder;
866
+ const readOnlyBorder = hasError ? errorColor : colors.surface;
867
+ const borderColor = editable ? editableBorder : readOnlyBorder;
866
868
  const editableFill = isFocused ? colors.surface : colors.surfaceElevated;
867
- const backgroundColor = editable ? editableFill : colors.background;
869
+ const backgroundColor = editable ? editableFill : colors.surface;
868
870
  const base = { color: editable ? colors.text : colors.textSecondary, borderColor, backgroundColor };
869
871
  if (!IS_WEB5) return base;
870
872
  const ringColor = hasError ? errorColor : uiButtons.themeFocusRingColor(theme);
@@ -1765,6 +1767,28 @@ function SelectControl({
1765
1767
  ) : null
1766
1768
  ] });
1767
1769
  }
1770
+ var SelectField = ({
1771
+ label,
1772
+ accessibilityHint,
1773
+ value,
1774
+ options,
1775
+ onChange,
1776
+ testID
1777
+ }) => {
1778
+ const selected = options.find((option) => option.value === value)?.label ?? "";
1779
+ return /* @__PURE__ */ jsxRuntime.jsx(Field, { label, children: ({ labelId }) => /* @__PURE__ */ jsxRuntime.jsx(
1780
+ SelectControl,
1781
+ {
1782
+ accessibilityHint,
1783
+ accessibilityLabel: `${label}: ${selected}`,
1784
+ labelledById: labelId,
1785
+ options,
1786
+ testID,
1787
+ value,
1788
+ onChange
1789
+ }
1790
+ ) });
1791
+ };
1768
1792
  var CLOSE_DELAY_MS2 = 140;
1769
1793
  function useDelayedBlurClose(open, close) {
1770
1794
  const timerRef = React2.useRef(null);
@@ -2353,6 +2377,7 @@ exports.FormSwitch = FormSwitch;
2353
2377
  exports.INLINE_FIELD_ROW_MIN_WIDTH = INLINE_FIELD_ROW_MIN_WIDTH;
2354
2378
  exports.InlineFieldRow = InlineFieldRow;
2355
2379
  exports.SelectControl = SelectControl;
2380
+ exports.SelectField = SelectField;
2356
2381
  exports.StepperNav = StepperNav;
2357
2382
  exports.StepperTabs = StepperTabs;
2358
2383
  exports.ThemedTextInput = ThemedTextInput;