@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.mjs CHANGED
@@ -908,7 +908,6 @@ function useThemedInput(options = {}) {
908
908
  colors.border,
909
909
  colors.surface,
910
910
  colors.surfaceElevated,
911
- colors.background,
912
911
  colors.textSecondary,
913
912
  editable,
914
913
  primary,
@@ -2166,7 +2165,8 @@ function WebDateInput({ fieldProps, context, webInputType }) {
2166
2165
  );
2167
2166
  }
2168
2167
  var IS_WEB7 = Platform.OS === "web";
2169
- function renderNativeInput(fieldProps, context) {
2168
+ function TemporalInput({ fieldProps, context, webInputType }) {
2169
+ if (IS_WEB7) return /* @__PURE__ */ jsx(WebDateInput, { context, fieldProps, webInputType });
2170
2170
  return /* @__PURE__ */ jsx(
2171
2171
  ThemedTextInput,
2172
2172
  {
@@ -2186,7 +2186,7 @@ function renderNativeInput(fieldProps, context) {
2186
2186
  }
2187
2187
  function TemporalField({ fieldProps, webInputType }) {
2188
2188
  const { label, required, hint, error } = fieldProps;
2189
- return /* @__PURE__ */ jsx(Field, { error, hint, label, required, children: (context) => IS_WEB7 ? /* @__PURE__ */ jsx(WebDateInput, { context, fieldProps, webInputType }) : renderNativeInput(fieldProps, context) });
2189
+ return /* @__PURE__ */ jsx(Field, { error, hint, label, required, children: (context) => /* @__PURE__ */ jsx(TemporalInput, { context, fieldProps, webInputType }) });
2190
2190
  }
2191
2191
  function DateField(props) {
2192
2192
  return /* @__PURE__ */ jsx(TemporalField, { fieldProps: props, webInputType: "date" });
@@ -2230,6 +2230,9 @@ function DateRangeControl({
2230
2230
  function DateTimeField(props) {
2231
2231
  return /* @__PURE__ */ jsx(TemporalField, { fieldProps: props, webInputType: "datetime-local" });
2232
2232
  }
2233
+ function DateInput({ fieldProps, context }) {
2234
+ return /* @__PURE__ */ jsx(TemporalInput, { context, fieldProps, webInputType: "date" });
2235
+ }
2233
2236
 
2234
2237
  // src/groupSelection/groupSelection.ts
2235
2238
  var NONE = 0;
@@ -2469,7 +2472,86 @@ var UploadWithLinkField = ({
2469
2472
  ) : null
2470
2473
  ] });
2471
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
+ };
2472
2554
 
2473
- export { AlignToControl, AnchoredMenu, ChipSelector, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateField, 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 };
2474
2556
  //# sourceMappingURL=index.mjs.map
2475
2557
  //# sourceMappingURL=index.mjs.map