@dloizides/ui-forms 1.30.0 → 1.31.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/dist/index.d.mts CHANGED
@@ -877,9 +877,11 @@ interface DateRangeControlProps {
877
877
  fromLabel: string;
878
878
  /** PRE-LOCALIZED sub-label for the TO input (e.g. "To"). Also its accessible name. */
879
879
  toLabel: string;
880
+ /** @deprecated Ignored: a date input shows no typed format hint (DATE-INPUT-1). */
880
881
  fromPlaceholder?: string;
882
+ /** @deprecated Ignored: a date input shows no typed format hint (DATE-INPUT-1). */
881
883
  toPlaceholder?: string;
882
- /** PRE-LOCALIZED hint applied to BOTH inputs. */
884
+ /** PRE-LOCALIZED hint applied to BOTH inputs; defaults to `<fromLabel> – <toLabel>`. */
883
885
  accessibilityHint?: string;
884
886
  /** Merged LAST onto the row wrapper. */
885
887
  style?: StyleProp<ViewStyle>;
@@ -887,7 +889,7 @@ interface DateRangeControlProps {
887
889
  testID: string;
888
890
  }
889
891
  /** An inclusive from/to date pair of two shared `DateField`s; each edit patches only its own side. */
890
- declare function DateRangeControl({ value, onChange, onSubmit, fromLabel, toLabel, fromPlaceholder, toPlaceholder, accessibilityHint, style, testID, }: DateRangeControlProps): React.ReactElement;
892
+ declare function DateRangeControl({ value, onChange, onSubmit, fromLabel, toLabel, accessibilityHint, style, testID, }: DateRangeControlProps): React.ReactElement;
891
893
 
892
894
  interface DateFieldProps {
893
895
  /** PRE-LOCALIZED label; also the accessible name. */
@@ -905,9 +907,14 @@ interface DateFieldProps {
905
907
  disabled?: boolean;
906
908
  min?: string;
907
909
  max?: string;
908
- placeholder?: string;
909
910
  }
910
911
  type DateTimeFieldProps = DateFieldProps;
912
+ interface DateInputProps {
913
+ /** The same props a `DateField` takes; `label` is the accessible name only. */
914
+ fieldProps: DateFieldProps;
915
+ /** The context `Field` hands its render-prop child. */
916
+ context: FieldChildContext;
917
+ }
911
918
 
912
919
  /** A labelled calendar date: takes and emits `YYYY-MM-DD`, empty is `''`. */
913
920
  declare function DateField(props: DateFieldProps): React.ReactElement;
@@ -915,6 +922,9 @@ declare function DateField(props: DateFieldProps): React.ReactElement;
915
922
  /** A labelled local date and time: takes and emits `YYYY-MM-DDTHH:mm`, empty is `''`. */
916
923
  declare function DateTimeField(props: DateTimeFieldProps): React.ReactElement;
917
924
 
925
+ /** A calendar date control with no label row, for a `Field` render-prop child whose caller owns the label. */
926
+ declare function DateInput({ fieldProps, context }: DateInputProps): React.ReactElement;
927
+
918
928
  /**
919
929
  * `AnchoredMenu` — the floating option list shared by `SelectControl` and `TypeaheadControl`.
920
930
  *
@@ -1234,4 +1244,4 @@ interface UploadWithLinkFieldProps {
1234
1244
  /** An image field: preview, an upload control, and a link input revealed on request. */
1235
1245
  declare const UploadWithLinkField: ({ value, onChange, labels, uploadControl, testID, disabled, previewSize, }: UploadWithLinkFieldProps) => React.ReactElement;
1236
1246
 
1237
- export { AlignToControl, type AlignToControlProps, AnchoredMenu, type AnchoredMenuColors, type AnchoredMenuListbox, type AnchoredMenuPlacement, 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, DateField, type DateFieldProps, DateRangeControl, type DateRangeControlProps, type DateRangeValue, DateTimeField, type DateTimeFieldProps, 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, FormStack, type FormStackProps, FormStatusLine, type FormStatusLineProps, FormSwitch, type FormSwitchProps, type GroupSelection, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, type InlineFieldRowLayout, type InlineFieldRowProps, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, type RecentValues, ResponsiveFormLayout, type ResponsiveFormLayoutProps, SelectControl, type SelectControlProps, SelectField, type SelectFieldProps, type SelectMenuAnchor, 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, isWideFormLayout, nextHighlight, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
1247
+ export { AlignToControl, type AlignToControlProps, AnchoredMenu, type AnchoredMenuColors, type AnchoredMenuListbox, type AnchoredMenuPlacement, 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, DateField, type DateFieldProps, DateInput, type DateInputProps, DateRangeControl, type DateRangeControlProps, type DateRangeValue, DateTimeField, type DateTimeFieldProps, 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, FormStack, type FormStackProps, FormStatusLine, type FormStatusLineProps, FormSwitch, type FormSwitchProps, type GroupSelection, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, type InlineFieldRowLayout, type InlineFieldRowProps, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, type RecentValues, ResponsiveFormLayout, type ResponsiveFormLayoutProps, SelectControl, type SelectControlProps, SelectField, type SelectFieldProps, type SelectMenuAnchor, 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, isWideFormLayout, nextHighlight, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
package/dist/index.d.ts CHANGED
@@ -877,9 +877,11 @@ interface DateRangeControlProps {
877
877
  fromLabel: string;
878
878
  /** PRE-LOCALIZED sub-label for the TO input (e.g. "To"). Also its accessible name. */
879
879
  toLabel: string;
880
+ /** @deprecated Ignored: a date input shows no typed format hint (DATE-INPUT-1). */
880
881
  fromPlaceholder?: string;
882
+ /** @deprecated Ignored: a date input shows no typed format hint (DATE-INPUT-1). */
881
883
  toPlaceholder?: string;
882
- /** PRE-LOCALIZED hint applied to BOTH inputs. */
884
+ /** PRE-LOCALIZED hint applied to BOTH inputs; defaults to `<fromLabel> – <toLabel>`. */
883
885
  accessibilityHint?: string;
884
886
  /** Merged LAST onto the row wrapper. */
885
887
  style?: StyleProp<ViewStyle>;
@@ -887,7 +889,7 @@ interface DateRangeControlProps {
887
889
  testID: string;
888
890
  }
889
891
  /** An inclusive from/to date pair of two shared `DateField`s; each edit patches only its own side. */
890
- declare function DateRangeControl({ value, onChange, onSubmit, fromLabel, toLabel, fromPlaceholder, toPlaceholder, accessibilityHint, style, testID, }: DateRangeControlProps): React.ReactElement;
892
+ declare function DateRangeControl({ value, onChange, onSubmit, fromLabel, toLabel, accessibilityHint, style, testID, }: DateRangeControlProps): React.ReactElement;
891
893
 
892
894
  interface DateFieldProps {
893
895
  /** PRE-LOCALIZED label; also the accessible name. */
@@ -905,9 +907,14 @@ interface DateFieldProps {
905
907
  disabled?: boolean;
906
908
  min?: string;
907
909
  max?: string;
908
- placeholder?: string;
909
910
  }
910
911
  type DateTimeFieldProps = DateFieldProps;
912
+ interface DateInputProps {
913
+ /** The same props a `DateField` takes; `label` is the accessible name only. */
914
+ fieldProps: DateFieldProps;
915
+ /** The context `Field` hands its render-prop child. */
916
+ context: FieldChildContext;
917
+ }
911
918
 
912
919
  /** A labelled calendar date: takes and emits `YYYY-MM-DD`, empty is `''`. */
913
920
  declare function DateField(props: DateFieldProps): React.ReactElement;
@@ -915,6 +922,9 @@ declare function DateField(props: DateFieldProps): React.ReactElement;
915
922
  /** A labelled local date and time: takes and emits `YYYY-MM-DDTHH:mm`, empty is `''`. */
916
923
  declare function DateTimeField(props: DateTimeFieldProps): React.ReactElement;
917
924
 
925
+ /** A calendar date control with no label row, for a `Field` render-prop child whose caller owns the label. */
926
+ declare function DateInput({ fieldProps, context }: DateInputProps): React.ReactElement;
927
+
918
928
  /**
919
929
  * `AnchoredMenu` — the floating option list shared by `SelectControl` and `TypeaheadControl`.
920
930
  *
@@ -1234,4 +1244,4 @@ interface UploadWithLinkFieldProps {
1234
1244
  /** An image field: preview, an upload control, and a link input revealed on request. */
1235
1245
  declare const UploadWithLinkField: ({ value, onChange, labels, uploadControl, testID, disabled, previewSize, }: UploadWithLinkFieldProps) => React.ReactElement;
1236
1246
 
1237
- export { AlignToControl, type AlignToControlProps, AnchoredMenu, type AnchoredMenuColors, type AnchoredMenuListbox, type AnchoredMenuPlacement, 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, DateField, type DateFieldProps, DateRangeControl, type DateRangeControlProps, type DateRangeValue, DateTimeField, type DateTimeFieldProps, 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, FormStack, type FormStackProps, FormStatusLine, type FormStatusLineProps, FormSwitch, type FormSwitchProps, type GroupSelection, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, type InlineFieldRowLayout, type InlineFieldRowProps, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, type RecentValues, ResponsiveFormLayout, type ResponsiveFormLayoutProps, SelectControl, type SelectControlProps, SelectField, type SelectFieldProps, type SelectMenuAnchor, 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, isWideFormLayout, nextHighlight, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
1247
+ export { AlignToControl, type AlignToControlProps, AnchoredMenu, type AnchoredMenuColors, type AnchoredMenuListbox, type AnchoredMenuPlacement, 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, DateField, type DateFieldProps, DateInput, type DateInputProps, DateRangeControl, type DateRangeControlProps, type DateRangeValue, DateTimeField, type DateTimeFieldProps, 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, FormStack, type FormStackProps, FormStatusLine, type FormStatusLineProps, FormSwitch, type FormSwitchProps, type GroupSelection, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, type InlineFieldRowLayout, type InlineFieldRowProps, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, type RecentValues, ResponsiveFormLayout, type ResponsiveFormLayoutProps, SelectControl, type SelectControlProps, SelectField, type SelectFieldProps, type SelectMenuAnchor, 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, isWideFormLayout, nextHighlight, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
package/dist/index.js CHANGED
@@ -914,7 +914,6 @@ function useThemedInput(options = {}) {
914
914
  colors.border,
915
915
  colors.surface,
916
916
  colors.surfaceElevated,
917
- colors.background,
918
917
  colors.textSecondary,
919
918
  editable,
920
919
  primary,
@@ -2172,7 +2171,8 @@ function WebDateInput({ fieldProps, context, webInputType }) {
2172
2171
  );
2173
2172
  }
2174
2173
  var IS_WEB7 = reactNative.Platform.OS === "web";
2175
- function renderNativeInput(fieldProps, context) {
2174
+ function TemporalInput({ fieldProps, context, webInputType }) {
2175
+ if (IS_WEB7) return /* @__PURE__ */ jsxRuntime.jsx(WebDateInput, { context, fieldProps, webInputType });
2176
2176
  return /* @__PURE__ */ jsxRuntime.jsx(
2177
2177
  ThemedTextInput,
2178
2178
  {
@@ -2182,7 +2182,6 @@ function renderNativeInput(fieldProps, context) {
2182
2182
  editable: fieldProps.disabled !== true,
2183
2183
  hasError: context.hasError,
2184
2184
  id: context.controlId,
2185
- placeholder: fieldProps.placeholder,
2186
2185
  requiredField: fieldProps.required,
2187
2186
  testID: fieldProps.testID,
2188
2187
  value: fieldProps.value,
@@ -2193,7 +2192,7 @@ function renderNativeInput(fieldProps, context) {
2193
2192
  }
2194
2193
  function TemporalField({ fieldProps, webInputType }) {
2195
2194
  const { label, required, hint, error } = fieldProps;
2196
- return /* @__PURE__ */ jsxRuntime.jsx(Field, { error, hint, label, required, children: (context) => IS_WEB7 ? /* @__PURE__ */ jsxRuntime.jsx(WebDateInput, { context, fieldProps, webInputType }) : renderNativeInput(fieldProps, context) });
2195
+ return /* @__PURE__ */ jsxRuntime.jsx(Field, { error, hint, label, required, children: (context) => /* @__PURE__ */ jsxRuntime.jsx(TemporalInput, { context, fieldProps, webInputType }) });
2197
2196
  }
2198
2197
  function DateField(props) {
2199
2198
  return /* @__PURE__ */ jsxRuntime.jsx(TemporalField, { fieldProps: props, webInputType: "date" });
@@ -2204,20 +2203,17 @@ function DateRangeControl({
2204
2203
  onSubmit,
2205
2204
  fromLabel,
2206
2205
  toLabel,
2207
- fromPlaceholder,
2208
- toPlaceholder,
2209
2206
  accessibilityHint,
2210
2207
  style,
2211
2208
  testID
2212
2209
  }) {
2213
- const hint = accessibilityHint ?? "";
2210
+ const hint = accessibilityHint ?? `${fromLabel} \u2013 ${toLabel}`;
2214
2211
  return /* @__PURE__ */ jsxRuntime.jsx(GapOwnedProvider, { value: true, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [controlStyles.dateRow, style], testID: `${testID}-range`, children: [
2215
2212
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: controlStyles.dateCol, children: /* @__PURE__ */ jsxRuntime.jsx(
2216
2213
  DateField,
2217
2214
  {
2218
2215
  accessibilityHint: hint,
2219
2216
  label: fromLabel,
2220
- placeholder: fromPlaceholder,
2221
2217
  testID: `${testID}-from`,
2222
2218
  value: value.from,
2223
2219
  onChange: (from) => onChange({ from, to: value.to }),
@@ -2229,7 +2225,6 @@ function DateRangeControl({
2229
2225
  {
2230
2226
  accessibilityHint: hint,
2231
2227
  label: toLabel,
2232
- placeholder: toPlaceholder,
2233
2228
  testID: `${testID}-to`,
2234
2229
  value: value.to,
2235
2230
  onChange: (to) => onChange({ from: value.from, to }),
@@ -2241,6 +2236,9 @@ function DateRangeControl({
2241
2236
  function DateTimeField(props) {
2242
2237
  return /* @__PURE__ */ jsxRuntime.jsx(TemporalField, { fieldProps: props, webInputType: "datetime-local" });
2243
2238
  }
2239
+ function DateInput({ fieldProps, context }) {
2240
+ return /* @__PURE__ */ jsxRuntime.jsx(TemporalInput, { context, fieldProps, webInputType: "date" });
2241
+ }
2244
2242
 
2245
2243
  // src/groupSelection/groupSelection.ts
2246
2244
  var NONE = 0;
@@ -2489,6 +2487,7 @@ exports.DEFAULT_OPTIONAL_LABEL = DEFAULT_OPTIONAL_LABEL;
2489
2487
  exports.DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS = DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS;
2490
2488
  exports.DEFAULT_TYPEAHEAD_MIN_CHARS = DEFAULT_TYPEAHEAD_MIN_CHARS;
2491
2489
  exports.DateField = DateField;
2490
+ exports.DateInput = DateInput;
2492
2491
  exports.DateRangeControl = DateRangeControl;
2493
2492
  exports.DateTimeField = DateTimeField;
2494
2493
  exports.Field = Field;