@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.mjs CHANGED
@@ -2472,7 +2472,86 @@ var UploadWithLinkField = ({
2472
2472
  ) : null
2473
2473
  ] });
2474
2474
  };
2475
+ var ACTION_GAP = 8;
2476
+ var GROUP_GAP = 16;
2477
+ var styles16 = StyleSheet.create({
2478
+ action: { alignItems: "flex-start", marginTop: ACTION_GAP },
2479
+ group: { marginBottom: GROUP_GAP }
2480
+ });
2481
+ var isAddOnOpen = (hasValue, requested) => hasValue || requested;
2482
+ var AddOnRequest = ({
2483
+ addLabel,
2484
+ addHint,
2485
+ removeLabel,
2486
+ removeHint,
2487
+ hasValue,
2488
+ onRemove,
2489
+ testID,
2490
+ children,
2491
+ disabled = false,
2492
+ style
2493
+ }) => {
2494
+ const [requested, setRequested] = useState(false);
2495
+ const remove = () => {
2496
+ setRequested(false);
2497
+ onRemove();
2498
+ };
2499
+ if (!isAddOnOpen(hasValue, requested))
2500
+ return /* @__PURE__ */ jsx(View, { style: [styles16.action, style], children: /* @__PURE__ */ jsx(
2501
+ Button,
2502
+ {
2503
+ accessibilityHint: addHint,
2504
+ accessibilityLabel: addLabel,
2505
+ disabled,
2506
+ label: addLabel,
2507
+ testID: `${testID}-add`,
2508
+ variant: "secondary",
2509
+ onPress: () => setRequested(true)
2510
+ }
2511
+ ) });
2512
+ return /* @__PURE__ */ jsxs(View, { style: [styles16.group, style], testID, children: [
2513
+ children,
2514
+ /* @__PURE__ */ jsx(View, { style: styles16.action, children: /* @__PURE__ */ jsx(
2515
+ Button,
2516
+ {
2517
+ accessibilityHint: removeHint,
2518
+ accessibilityLabel: removeLabel,
2519
+ disabled,
2520
+ label: removeLabel,
2521
+ testID: `${testID}-remove`,
2522
+ variant: "secondary",
2523
+ onPress: remove
2524
+ }
2525
+ ) })
2526
+ ] });
2527
+ };
2528
+ var ROW_GAP3 = 8;
2529
+ var TEXT_SIZE = 13;
2530
+ var TEXT_LINE = 18;
2531
+ var styles17 = StyleSheet.create({
2532
+ row: { alignItems: "center", columnGap: ROW_GAP3, flexDirection: "row", justifyContent: "space-between" },
2533
+ text: { flexShrink: 1, fontSize: TEXT_SIZE, fontWeight: "700", lineHeight: TEXT_LINE }
2534
+ });
2535
+ var isFixBarVisible = (count) => count > 0;
2536
+ var FixBar = ({ count, message, showLabel, showHint, onShow, testID, style }) => {
2537
+ const { theme } = useUi();
2538
+ if (!isFixBarVisible(count)) return null;
2539
+ return /* @__PURE__ */ jsxs(View, { style: [styles17.row, style], testID, children: [
2540
+ /* @__PURE__ */ jsx(Text, { role: "alert", style: [styles17.text, { color: fieldErrorInk(theme) }], testID: `${testID}-count`, children: message }),
2541
+ /* @__PURE__ */ jsx(
2542
+ Button,
2543
+ {
2544
+ accessibilityHint: showHint,
2545
+ accessibilityLabel: showLabel,
2546
+ label: showLabel,
2547
+ testID: `${testID}-show`,
2548
+ variant: "secondary",
2549
+ onPress: onShow
2550
+ }
2551
+ )
2552
+ ] });
2553
+ };
2475
2554
 
2476
- export { AlignToControl, AnchoredMenu, ChipSelector, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateField, DateInput, DateRangeControl, DateTimeField, Field, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormStack, FormStatusLine, FormSwitch, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, ResponsiveFormLayout, SelectControl, SelectField, StepperNav, StepperTabs, ThemedTextInput, TypeaheadControl, UploadWithLinkField, controlStyles, groupAriaChecked, inlineFieldRowLayout, isUnmatched, isWideFormLayout, nextHighlight, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
2555
+ export { AddOnRequest, AlignToControl, AnchoredMenu, ChipSelector, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateField, DateInput, DateRangeControl, DateTimeField, Field, FixBar, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormStack, FormStatusLine, FormSwitch, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, ResponsiveFormLayout, SelectControl, SelectField, StepperNav, StepperTabs, ThemedTextInput, TypeaheadControl, UploadWithLinkField, controlStyles, groupAriaChecked, inlineFieldRowLayout, isAddOnOpen, isFixBarVisible, isUnmatched, isWideFormLayout, nextHighlight, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
2477
2556
  //# sourceMappingURL=index.mjs.map
2478
2557
  //# sourceMappingURL=index.mjs.map