@dloizides/ui-forms 1.31.0 → 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
@@ -1244,4 +1244,35 @@ interface UploadWithLinkFieldProps {
1244
1244
  /** An image field: preview, an upload control, and a link input revealed on request. */
1245
1245
  declare const UploadWithLinkField: ({ value, onChange, labels, uploadControl, testID, disabled, previewSize, }: UploadWithLinkFieldProps) => React.ReactElement;
1246
1246
 
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 };
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
@@ -1244,4 +1244,35 @@ interface UploadWithLinkFieldProps {
1244
1244
  /** An image field: preview, an upload control, and a link input revealed on request. */
1245
1245
  declare const UploadWithLinkField: ({ value, onChange, labels, uploadControl, testID, disabled, previewSize, }: UploadWithLinkFieldProps) => React.ReactElement;
1246
1246
 
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 };
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
@@ -2478,7 +2478,87 @@ var UploadWithLinkField = ({
2478
2478
  ) : null
2479
2479
  ] });
2480
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
+ };
2481
2560
 
2561
+ exports.AddOnRequest = AddOnRequest;
2482
2562
  exports.AlignToControl = AlignToControl;
2483
2563
  exports.AnchoredMenu = AnchoredMenu;
2484
2564
  exports.ChipSelector = ChipSelector;
@@ -2491,6 +2571,7 @@ exports.DateInput = DateInput;
2491
2571
  exports.DateRangeControl = DateRangeControl;
2492
2572
  exports.DateTimeField = DateTimeField;
2493
2573
  exports.Field = Field;
2574
+ exports.FixBar = FixBar;
2494
2575
  exports.FormActions = FormActions;
2495
2576
  exports.FormCell = FormCell;
2496
2577
  exports.FormCheckbox = FormCheckbox;
@@ -2514,6 +2595,8 @@ exports.UploadWithLinkField = UploadWithLinkField;
2514
2595
  exports.controlStyles = controlStyles;
2515
2596
  exports.groupAriaChecked = groupAriaChecked;
2516
2597
  exports.inlineFieldRowLayout = inlineFieldRowLayout;
2598
+ exports.isAddOnOpen = isAddOnOpen;
2599
+ exports.isFixBarVisible = isFixBarVisible;
2517
2600
  exports.isUnmatched = isUnmatched;
2518
2601
  exports.isWideFormLayout = isWideFormLayout;
2519
2602
  exports.nextHighlight = nextHighlight;