@dloizides/ui-forms 1.30.1 → 1.32.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
@@ -909,6 +909,12 @@ interface DateFieldProps {
909
909
  max?: string;
910
910
  }
911
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
+ }
912
918
 
913
919
  /** A labelled calendar date: takes and emits `YYYY-MM-DD`, empty is `''`. */
914
920
  declare function DateField(props: DateFieldProps): React.ReactElement;
@@ -916,6 +922,9 @@ declare function DateField(props: DateFieldProps): React.ReactElement;
916
922
  /** A labelled local date and time: takes and emits `YYYY-MM-DDTHH:mm`, empty is `''`. */
917
923
  declare function DateTimeField(props: DateTimeFieldProps): React.ReactElement;
918
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
+
919
928
  /**
920
929
  * `AnchoredMenu` — the floating option list shared by `SelectControl` and `TypeaheadControl`.
921
930
  *
@@ -1235,4 +1244,35 @@ interface UploadWithLinkFieldProps {
1235
1244
  /** An image field: preview, an upload control, and a link input revealed on request. */
1236
1245
  declare const UploadWithLinkField: ({ value, onChange, labels, uploadControl, testID, disabled, previewSize, }: UploadWithLinkFieldProps) => React.ReactElement;
1237
1246
 
1238
- 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
+ interface AddOnRequestProps {
1248
+ addLabel: string;
1249
+ addHint: string;
1250
+ removeLabel: string;
1251
+ removeHint: string;
1252
+ hasValue: boolean;
1253
+ onRemove: () => void;
1254
+ testID: string;
1255
+ children: React.ReactNode;
1256
+ disabled?: boolean;
1257
+ style?: StyleProp<ViewStyle>;
1258
+ }
1259
+ /** Whether an optional field group shows its fields: once it holds a value or the user asked for it. */
1260
+ declare const isAddOnOpen: (hasValue: boolean, requested: boolean) => boolean;
1261
+ /** An optional field group: an Add button until asked for or filled, then the fields (children) and a Remove button. */
1262
+ declare const AddOnRequest: ({ addLabel, addHint, removeLabel, removeHint, hasValue, onRemove, testID, children, disabled, style, }: AddOnRequestProps) => React.ReactElement;
1263
+
1264
+ interface FixBarProps {
1265
+ count: number;
1266
+ message: string;
1267
+ showLabel: string;
1268
+ showHint: string;
1269
+ onShow: () => void;
1270
+ testID: string;
1271
+ style?: StyleProp<ViewStyle>;
1272
+ }
1273
+ /** Whether the fix bar shows: only while at least one field stops the save. */
1274
+ declare const isFixBarVisible: (count: number) => boolean;
1275
+ /** A bar above Save: a pre-localized message naming the fields that stop the save, and a Show button. */
1276
+ declare const FixBar: ({ count, message, showLabel, showHint, onShow, testID, style }: FixBarProps) => React.ReactElement | null;
1277
+
1278
+ export { AddOnRequest, type AddOnRequestProps, 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, FixBar, type FixBarProps, 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, isAddOnOpen, isFixBarVisible, isUnmatched, isWideFormLayout, nextHighlight, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
package/dist/index.d.ts CHANGED
@@ -909,6 +909,12 @@ interface DateFieldProps {
909
909
  max?: string;
910
910
  }
911
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
+ }
912
918
 
913
919
  /** A labelled calendar date: takes and emits `YYYY-MM-DD`, empty is `''`. */
914
920
  declare function DateField(props: DateFieldProps): React.ReactElement;
@@ -916,6 +922,9 @@ declare function DateField(props: DateFieldProps): React.ReactElement;
916
922
  /** A labelled local date and time: takes and emits `YYYY-MM-DDTHH:mm`, empty is `''`. */
917
923
  declare function DateTimeField(props: DateTimeFieldProps): React.ReactElement;
918
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
+
919
928
  /**
920
929
  * `AnchoredMenu` — the floating option list shared by `SelectControl` and `TypeaheadControl`.
921
930
  *
@@ -1235,4 +1244,35 @@ interface UploadWithLinkFieldProps {
1235
1244
  /** An image field: preview, an upload control, and a link input revealed on request. */
1236
1245
  declare const UploadWithLinkField: ({ value, onChange, labels, uploadControl, testID, disabled, previewSize, }: UploadWithLinkFieldProps) => React.ReactElement;
1237
1246
 
1238
- 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
+ interface AddOnRequestProps {
1248
+ addLabel: string;
1249
+ addHint: string;
1250
+ removeLabel: string;
1251
+ removeHint: string;
1252
+ hasValue: boolean;
1253
+ onRemove: () => void;
1254
+ testID: string;
1255
+ children: React.ReactNode;
1256
+ disabled?: boolean;
1257
+ style?: StyleProp<ViewStyle>;
1258
+ }
1259
+ /** Whether an optional field group shows its fields: once it holds a value or the user asked for it. */
1260
+ declare const isAddOnOpen: (hasValue: boolean, requested: boolean) => boolean;
1261
+ /** An optional field group: an Add button until asked for or filled, then the fields (children) and a Remove button. */
1262
+ declare const AddOnRequest: ({ addLabel, addHint, removeLabel, removeHint, hasValue, onRemove, testID, children, disabled, style, }: AddOnRequestProps) => React.ReactElement;
1263
+
1264
+ interface FixBarProps {
1265
+ count: number;
1266
+ message: string;
1267
+ showLabel: string;
1268
+ showHint: string;
1269
+ onShow: () => void;
1270
+ testID: string;
1271
+ style?: StyleProp<ViewStyle>;
1272
+ }
1273
+ /** Whether the fix bar shows: only while at least one field stops the save. */
1274
+ declare const isFixBarVisible: (count: number) => boolean;
1275
+ /** A bar above Save: a pre-localized message naming the fields that stop the save, and a Show button. */
1276
+ declare const FixBar: ({ count, message, showLabel, showHint, onShow, testID, style }: FixBarProps) => React.ReactElement | null;
1277
+
1278
+ export { AddOnRequest, type AddOnRequestProps, 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, FixBar, type FixBarProps, 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, isAddOnOpen, isFixBarVisible, 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
  {
@@ -2192,7 +2192,7 @@ function renderNativeInput(fieldProps, context) {
2192
2192
  }
2193
2193
  function TemporalField({ fieldProps, webInputType }) {
2194
2194
  const { label, required, hint, error } = fieldProps;
2195
- 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 }) });
2196
2196
  }
2197
2197
  function DateField(props) {
2198
2198
  return /* @__PURE__ */ jsxRuntime.jsx(TemporalField, { fieldProps: props, webInputType: "date" });
@@ -2236,6 +2236,9 @@ function DateRangeControl({
2236
2236
  function DateTimeField(props) {
2237
2237
  return /* @__PURE__ */ jsxRuntime.jsx(TemporalField, { fieldProps: props, webInputType: "datetime-local" });
2238
2238
  }
2239
+ function DateInput({ fieldProps, context }) {
2240
+ return /* @__PURE__ */ jsxRuntime.jsx(TemporalInput, { context, fieldProps, webInputType: "date" });
2241
+ }
2239
2242
 
2240
2243
  // src/groupSelection/groupSelection.ts
2241
2244
  var NONE = 0;
@@ -2475,7 +2478,87 @@ var UploadWithLinkField = ({
2475
2478
  ) : null
2476
2479
  ] });
2477
2480
  };
2481
+ var ACTION_GAP = 8;
2482
+ var GROUP_GAP = 16;
2483
+ var styles16 = reactNative.StyleSheet.create({
2484
+ action: { alignItems: "flex-start", marginTop: ACTION_GAP },
2485
+ group: { marginBottom: GROUP_GAP }
2486
+ });
2487
+ var isAddOnOpen = (hasValue, requested) => hasValue || requested;
2488
+ var AddOnRequest = ({
2489
+ addLabel,
2490
+ addHint,
2491
+ removeLabel,
2492
+ removeHint,
2493
+ hasValue,
2494
+ onRemove,
2495
+ testID,
2496
+ children,
2497
+ disabled = false,
2498
+ style
2499
+ }) => {
2500
+ const [requested, setRequested] = React2.useState(false);
2501
+ const remove = () => {
2502
+ setRequested(false);
2503
+ onRemove();
2504
+ };
2505
+ if (!isAddOnOpen(hasValue, requested))
2506
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles16.action, style], children: /* @__PURE__ */ jsxRuntime.jsx(
2507
+ uiButtons.Button,
2508
+ {
2509
+ accessibilityHint: addHint,
2510
+ accessibilityLabel: addLabel,
2511
+ disabled,
2512
+ label: addLabel,
2513
+ testID: `${testID}-add`,
2514
+ variant: "secondary",
2515
+ onPress: () => setRequested(true)
2516
+ }
2517
+ ) });
2518
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles16.group, style], testID, children: [
2519
+ children,
2520
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles16.action, children: /* @__PURE__ */ jsxRuntime.jsx(
2521
+ uiButtons.Button,
2522
+ {
2523
+ accessibilityHint: removeHint,
2524
+ accessibilityLabel: removeLabel,
2525
+ disabled,
2526
+ label: removeLabel,
2527
+ testID: `${testID}-remove`,
2528
+ variant: "secondary",
2529
+ onPress: remove
2530
+ }
2531
+ ) })
2532
+ ] });
2533
+ };
2534
+ var ROW_GAP3 = 8;
2535
+ var TEXT_SIZE = 13;
2536
+ var TEXT_LINE = 18;
2537
+ var styles17 = reactNative.StyleSheet.create({
2538
+ row: { alignItems: "center", columnGap: ROW_GAP3, flexDirection: "row", justifyContent: "space-between" },
2539
+ text: { flexShrink: 1, fontSize: TEXT_SIZE, fontWeight: "700", lineHeight: TEXT_LINE }
2540
+ });
2541
+ var isFixBarVisible = (count) => count > 0;
2542
+ var FixBar = ({ count, message, showLabel, showHint, onShow, testID, style }) => {
2543
+ const { theme } = uiFeedback.useUi();
2544
+ if (!isFixBarVisible(count)) return null;
2545
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles17.row, style], testID, children: [
2546
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { role: "alert", style: [styles17.text, { color: fieldErrorInk(theme) }], testID: `${testID}-count`, children: message }),
2547
+ /* @__PURE__ */ jsxRuntime.jsx(
2548
+ uiButtons.Button,
2549
+ {
2550
+ accessibilityHint: showHint,
2551
+ accessibilityLabel: showLabel,
2552
+ label: showLabel,
2553
+ testID: `${testID}-show`,
2554
+ variant: "secondary",
2555
+ onPress: onShow
2556
+ }
2557
+ )
2558
+ ] });
2559
+ };
2478
2560
 
2561
+ exports.AddOnRequest = AddOnRequest;
2479
2562
  exports.AlignToControl = AlignToControl;
2480
2563
  exports.AnchoredMenu = AnchoredMenu;
2481
2564
  exports.ChipSelector = ChipSelector;
@@ -2484,9 +2567,11 @@ exports.DEFAULT_OPTIONAL_LABEL = DEFAULT_OPTIONAL_LABEL;
2484
2567
  exports.DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS = DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS;
2485
2568
  exports.DEFAULT_TYPEAHEAD_MIN_CHARS = DEFAULT_TYPEAHEAD_MIN_CHARS;
2486
2569
  exports.DateField = DateField;
2570
+ exports.DateInput = DateInput;
2487
2571
  exports.DateRangeControl = DateRangeControl;
2488
2572
  exports.DateTimeField = DateTimeField;
2489
2573
  exports.Field = Field;
2574
+ exports.FixBar = FixBar;
2490
2575
  exports.FormActions = FormActions;
2491
2576
  exports.FormCell = FormCell;
2492
2577
  exports.FormCheckbox = FormCheckbox;
@@ -2510,6 +2595,8 @@ exports.UploadWithLinkField = UploadWithLinkField;
2510
2595
  exports.controlStyles = controlStyles;
2511
2596
  exports.groupAriaChecked = groupAriaChecked;
2512
2597
  exports.inlineFieldRowLayout = inlineFieldRowLayout;
2598
+ exports.isAddOnOpen = isAddOnOpen;
2599
+ exports.isFixBarVisible = isFixBarVisible;
2513
2600
  exports.isUnmatched = isUnmatched;
2514
2601
  exports.isWideFormLayout = isWideFormLayout;
2515
2602
  exports.nextHighlight = nextHighlight;