@jobber/components-native 0.90.1-JOB-140976-fc0b992.18 → 0.90.1-JOB-142149-547612b.8

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.
Files changed (41) hide show
  1. package/dist/package.json +2 -2
  2. package/dist/src/Form/Form.js +1 -1
  3. package/dist/src/Form/components/FormBody/FormBody.js +5 -5
  4. package/dist/src/InputDate/InputDate.js +2 -2
  5. package/dist/src/InputFieldWrapper/InputFieldWrapper.js +12 -14
  6. package/dist/src/InputFieldWrapper/components/Prefix/Prefix.js +2 -5
  7. package/dist/src/InputFieldWrapper/components/Suffix/Suffix.js +2 -5
  8. package/dist/src/InputPressable/InputPressable.js +8 -20
  9. package/dist/src/InputPressable/InputPressable.style.js +0 -3
  10. package/dist/src/InputText/InputText.js +11 -22
  11. package/dist/src/InputText/InputText.style.js +0 -4
  12. package/dist/src/InputTime/InputTime.js +2 -2
  13. package/dist/tsconfig.build.tsbuildinfo +1 -1
  14. package/dist/types/src/InputDate/InputDate.d.ts +1 -2
  15. package/dist/types/src/InputFieldWrapper/InputFieldWrapper.d.ts +2 -9
  16. package/dist/types/src/InputFieldWrapper/components/Prefix/Prefix.d.ts +3 -2
  17. package/dist/types/src/InputFieldWrapper/components/Suffix/Suffix.d.ts +3 -2
  18. package/dist/types/src/InputPressable/InputPressable.d.ts +1 -9
  19. package/dist/types/src/InputPressable/InputPressable.style.d.ts +0 -3
  20. package/dist/types/src/InputSearch/InputSearch.d.ts +1 -1
  21. package/dist/types/src/InputText/InputText.d.ts +0 -8
  22. package/dist/types/src/InputText/InputText.style.d.ts +0 -4
  23. package/dist/types/src/InputTime/InputTime.d.ts +1 -2
  24. package/package.json +2 -2
  25. package/src/Form/Form.tsx +0 -1
  26. package/src/Form/components/FormBody/FormBody.tsx +6 -6
  27. package/src/InputDate/InputDate.tsx +1 -5
  28. package/src/InputFieldWrapper/InputFieldWrapper.test.tsx +1 -48
  29. package/src/InputFieldWrapper/InputFieldWrapper.tsx +28 -38
  30. package/src/InputFieldWrapper/components/Prefix/Prefix.test.tsx +5 -3
  31. package/src/InputFieldWrapper/components/Prefix/Prefix.tsx +4 -6
  32. package/src/InputFieldWrapper/components/Suffix/Suffix.test.tsx +4 -2
  33. package/src/InputFieldWrapper/components/Suffix/Suffix.tsx +4 -6
  34. package/src/InputPressable/InputPressable.style.ts +0 -4
  35. package/src/InputPressable/InputPressable.test.tsx +1 -75
  36. package/src/InputPressable/InputPressable.tsx +7 -33
  37. package/src/InputSearch/InputSearch.tsx +0 -1
  38. package/src/InputText/InputText.style.ts +0 -5
  39. package/src/InputText/InputText.test.tsx +0 -75
  40. package/src/InputText/InputText.tsx +12 -32
  41. package/src/InputTime/InputTime.tsx +1 -5
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.90.1-JOB-140976-fc0b992.18+fc0b9928e",
3
+ "version": "0.90.1-JOB-142149-547612b.8+547612b28",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -94,5 +94,5 @@
94
94
  "react-native-safe-area-context": "^5.4.0",
95
95
  "react-native-svg": ">=12.0.0"
96
96
  },
97
- "gitHead": "fc0b9928ec110279df2577c8646e8c423c57e56a"
97
+ "gitHead": "547612b28b6ea97cd710210ecbbe6917da0c9734"
98
98
  }
@@ -110,7 +110,7 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
110
110
  (isSubmitting || isSecondaryActionLoading) && React.createElement(FormMask, null),
111
111
  React.createElement(FormCache, { localCacheKey: localCacheKey, localCacheExclude: localCacheExclude, setLocalCache: setLocalCache }),
112
112
  React.createElement(FormBody, { keyboardHeight: calculateSaveButtonOffset(), submit: handleSubmit(internalSubmit), isFormSubmitting: isSubmitting, saveButtonLabel: saveButtonLabel, shouldRenderActionBar: saveButtonPosition === "sticky", renderStickySection: renderStickySection, secondaryActions: secondaryActions, setSecondaryActionLoading: setIsSecondaryActionLoading, setSaveButtonHeight: setSaveButtonHeight, saveButtonOffset: saveButtonOffset },
113
- React.createElement(KeyboardAwareScrollView, Object.assign({ enableResetScrollToCoords: false, enableAutomaticScroll: true, enableOnAndroid: edgeToEdgeEnabled, keyboardOpeningTime: Platform.OS === "ios" ? tokens["timing-slowest"] : 0, keyboardShouldPersistTaps: "handled", ref: scrollViewRef }, keyboardProps, { extraHeight: headerHeight, extraScrollHeight: edgeToEdgeEnabled ? tokens["space-large"] : 0, contentContainerStyle: !keyboardHeight && styles.scrollContentContainer }),
113
+ React.createElement(KeyboardAwareScrollView, Object.assign({ enableResetScrollToCoords: false, enableAutomaticScroll: true, enableOnAndroid: edgeToEdgeEnabled, keyboardOpeningTime: Platform.OS === "ios" ? tokens["timing-slowest"] : 0, keyboardShouldPersistTaps: "handled", ref: scrollViewRef }, keyboardProps, { extraHeight: headerHeight, contentContainerStyle: !keyboardHeight && styles.scrollContentContainer }),
114
114
  React.createElement(View, { onLayout: ({ nativeEvent }) => {
115
115
  setFormContentHeight(nativeEvent.layout.height);
116
116
  } },
@@ -1,18 +1,18 @@
1
- import React, { useMemo } from "react";
1
+ import React from "react";
2
2
  import { View } from "react-native";
3
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
3
4
  import { useStyles } from "./FormBody.style";
4
5
  import { useScreenInformation } from "../../hooks/useScreenInformation";
5
6
  import { FormActionBar } from "../FormActionBar";
6
7
  import { tokens } from "../../../utils/design";
7
8
  export function FormBody({ isFormSubmitting, submit, keyboardHeight, children, saveButtonLabel, renderStickySection, shouldRenderActionBar = true, secondaryActions, setSecondaryActionLoading, setSaveButtonHeight, saveButtonOffset, }) {
8
- const paddingBottom = useBottomPadding();
9
- const fullViewPadding = useMemo(() => ({ paddingBottom }), [paddingBottom]);
9
+ const { bottom: paddingBottom } = useSafeAreaInsets();
10
10
  const styles = useStyles();
11
11
  return (React.createElement(React.Fragment, null,
12
- React.createElement(View, { style: [styles.container] },
12
+ React.createElement(View, { style: styles.container },
13
13
  children,
14
14
  shouldRenderActionBar && (React.createElement(FormActionBar, { setSecondaryActionLoading: setSecondaryActionLoading, keyboardHeight: keyboardHeight, submit: submit, isFormSubmitting: isFormSubmitting, saveButtonLabel: saveButtonLabel, renderStickySection: renderStickySection, secondaryActions: secondaryActions, setSaveButtonHeight: setSaveButtonHeight }))),
15
- shouldRenderActionBar && !saveButtonOffset && (React.createElement(View, { style: [fullViewPadding, styles.safeArea], testID: "ATL-FormSafeArea" }))));
15
+ !saveButtonOffset && (React.createElement(View, { style: [{ paddingBottom }, styles.safeArea], testID: "ATL-FormSafeArea" }))));
16
16
  }
17
17
  export function useBottomPadding() {
18
18
  const { insets } = useScreenInformation();
@@ -27,7 +27,7 @@ export function InputDate(props) {
27
27
  }
28
28
  return React.createElement(InternalInputDate, Object.assign({}, props));
29
29
  }
30
- function InternalInputDate({ clearable = "always", disabled, emptyValueLabel, invalid, maxDate, minDate, placeholder, value, showMiniLabel = true, name, onChange, accessibilityLabel, accessibilityHint, }) {
30
+ function InternalInputDate({ clearable = "always", disabled, emptyValueLabel, invalid, maxDate, minDate, placeholder, value, name, onChange, accessibilityLabel, accessibilityHint, }) {
31
31
  const [showPicker, setShowPicker] = useState(false);
32
32
  const { t, locale, formatDate } = useAtlantisI18n();
33
33
  const date = useMemo(() => {
@@ -44,7 +44,7 @@ function InternalInputDate({ clearable = "always", disabled, emptyValueLabel, in
44
44
  const canClearDate = formattedDate === emptyValueLabel ? "never" : clearable;
45
45
  const placeholderLabel = placeholder !== null && placeholder !== void 0 ? placeholder : t("date");
46
46
  return (React.createElement(React.Fragment, null,
47
- React.createElement(InputPressable, { showMiniLabel: showMiniLabel, focused: showPicker, clearable: canClearDate, disabled: disabled, invalid: invalid, placeholder: placeholderLabel, prefix: { icon: "calendar" }, value: formattedDate, onClear: handleClear, onPress: showDatePicker, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint }),
47
+ React.createElement(InputPressable, { focused: showPicker, clearable: canClearDate, disabled: disabled, invalid: invalid, placeholder: placeholderLabel, prefix: { icon: "calendar" }, value: formattedDate, onClear: handleClear, onPress: showDatePicker, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint }),
48
48
  React.createElement(DateTimePicker, { testID: "inputDate-datePicker", date: date || undefined, display: display, isVisible: showPicker, maximumDate: maxDate, minimumDate: minDate, mode: "date", confirmTextIOS: t("confirm"), cancelTextIOS: t("cancel"), locale: locale, onCancel: handleCancel, onConfirm: handleConfirm })));
49
49
  function showDatePicker() {
50
50
  Keyboard.dismiss();
@@ -11,7 +11,7 @@ import { Text } from "../Text";
11
11
  import { ActivityIndicator } from "../ActivityIndicator";
12
12
  export const INPUT_FIELD_WRAPPER_GLIMMERS_TEST_ID = "ATL-InputFieldWrapper-Glimmers";
13
13
  export const INPUT_FIELD_WRAPPER_SPINNER_TEST_ID = "ATL-InputFieldWrapper-Spinner";
14
- export function InputFieldWrapper({ invalid, disabled, placeholder, assistiveText, prefix, suffix, placeholderMode = "normal", hasValue = false, error, focused = false, children, onClear, showClearAction = false, styleOverride, toolbar, toolbarVisibility = "while-editing", loading = false, loadingType = "spinner", }) {
14
+ export function InputFieldWrapper({ invalid, disabled, placeholder, assistiveText, prefix, suffix, hasMiniLabel = false, hasValue = false, error, focused = false, children, onClear, showClearAction = false, styleOverride, toolbar, toolbarVisibility = "while-editing", loading = false, loadingType = "spinner", }) {
15
15
  fieldAffixRequiredPropsCheck([prefix, suffix]);
16
16
  const handleClear = onClear !== null && onClear !== void 0 ? onClear : noopClear;
17
17
  warnIfClearActionWithNoOnClear(onClear, showClearAction);
@@ -20,8 +20,6 @@ export function InputFieldWrapper({ invalid, disabled, placeholder, assistiveTex
20
20
  const showLoadingSpinner = loading && loadingType === "spinner";
21
21
  const showLoadingGlimmer = loading && loadingType === "glimmer";
22
22
  const styles = useStyles();
23
- const placeholderVisible = placeholderMode !== "hidden";
24
- const miniLabelActive = placeholderMode === "mini";
25
23
  return (React.createElement(ErrorMessageWrapper, { message: getMessage({ invalid, error }) },
26
24
  React.createElement(View, { testID: "ATL-InputFieldWrapper", style: [
27
25
  styles.container,
@@ -31,18 +29,18 @@ export function InputFieldWrapper({ invalid, disabled, placeholder, assistiveTex
31
29
  styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.container,
32
30
  ] },
33
31
  React.createElement(View, { style: styles.field },
34
- (prefix === null || prefix === void 0 ? void 0 : prefix.icon) && (React.createElement(PrefixIcon, { disabled: disabled, focused: focused, inputInvalid: inputInvalid, icon: prefix.icon })),
32
+ (prefix === null || prefix === void 0 ? void 0 : prefix.icon) && (React.createElement(PrefixIcon, { disabled: disabled, focused: focused, hasMiniLabel: hasMiniLabel, inputInvalid: inputInvalid, icon: prefix.icon })),
35
33
  React.createElement(View, { style: [styles.inputContainer] },
36
- placeholderVisible && (React.createElement(View, { style: [
34
+ React.createElement(View, { style: [
37
35
  !!placeholder && styles.label,
38
- miniLabelActive && styles.miniLabel,
36
+ hasMiniLabel && styles.miniLabel,
39
37
  disabled && styles.disabled,
40
- miniLabelActive &&
38
+ hasMiniLabel &&
41
39
  showClearAction &&
42
40
  styles.miniLabelShowClearAction,
43
41
  ], pointerEvents: "none" },
44
- React.createElement(Placeholder, { placeholder: placeholder, labelVariation: getLabelVariation(error, invalid, disabled), miniLabelActive: miniLabelActive, styleOverride: styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.placeholderText }))),
45
- (prefix === null || prefix === void 0 ? void 0 : prefix.label) && hasValue && (React.createElement(PrefixLabel, { disabled: disabled, focused: focused, miniLabelActive: miniLabelActive, inputInvalid: inputInvalid, label: prefix.label, styleOverride: styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.prefixLabel })),
42
+ React.createElement(Placeholder, { placeholder: placeholder, labelVariation: getLabelVariation(error, invalid, disabled), hasMiniLabel: hasMiniLabel, styleOverride: styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.placeholderText })),
43
+ (prefix === null || prefix === void 0 ? void 0 : prefix.label) && hasValue && (React.createElement(PrefixLabel, { disabled: disabled, focused: focused, hasMiniLabel: hasMiniLabel, inputInvalid: inputInvalid, label: prefix.label, styleOverride: styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.prefixLabel })),
46
44
  children,
47
45
  showLoadingGlimmer && (React.createElement(View, { testID: INPUT_FIELD_WRAPPER_GLIMMERS_TEST_ID, style: [
48
46
  styles.loadingGlimmers,
@@ -56,10 +54,10 @@ export function InputFieldWrapper({ invalid, disabled, placeholder, assistiveTex
56
54
  (suffix === null || suffix === void 0 ? void 0 : suffix.icon) ||
57
55
  showLoadingSpinner) && (React.createElement(View, { style: styles.inputEndContainer },
58
56
  showClearAction && (React.createElement(ClearAction, { hasMarginRight: !!(suffix === null || suffix === void 0 ? void 0 : suffix.icon) || !!(suffix === null || suffix === void 0 ? void 0 : suffix.label), onPress: handleClear })),
59
- (suffix === null || suffix === void 0 ? void 0 : suffix.label) && hasValue && (React.createElement(SuffixLabel, { disabled: disabled, focused: focused, miniLabelActive: miniLabelActive, inputInvalid: inputInvalid, label: suffix.label, hasLeftMargin: !showClearAction, styleOverride: styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.suffixLabel })),
57
+ (suffix === null || suffix === void 0 ? void 0 : suffix.label) && hasValue && (React.createElement(SuffixLabel, { disabled: disabled, focused: focused, hasMiniLabel: hasMiniLabel, inputInvalid: inputInvalid, label: suffix.label, hasLeftMargin: !showClearAction, styleOverride: styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.suffixLabel })),
60
58
  showLoadingSpinner && (React.createElement(View, { style: styles.loadingSpinner },
61
59
  React.createElement(ActivityIndicator, { testID: INPUT_FIELD_WRAPPER_SPINNER_TEST_ID }))),
62
- (suffix === null || suffix === void 0 ? void 0 : suffix.icon) && (React.createElement(SuffixIcon, { disabled: disabled, focused: focused, hasLeftMargin: !!(!showClearAction || (suffix === null || suffix === void 0 ? void 0 : suffix.label)), inputInvalid: inputInvalid, icon: suffix.icon, onPress: suffix.onPress })))))),
60
+ (suffix === null || suffix === void 0 ? void 0 : suffix.icon) && (React.createElement(SuffixIcon, { disabled: disabled, focused: focused, hasMiniLabel: hasMiniLabel, hasLeftMargin: !!(!showClearAction || (suffix === null || suffix === void 0 ? void 0 : suffix.label)), inputInvalid: inputInvalid, icon: suffix.icon, onPress: suffix.onPress })))))),
63
61
  isToolbarVisible && React.createElement(View, { style: styles.toolbar }, toolbar)),
64
62
  assistiveText && !error && !invalid && (React.createElement(Text, { level: "textSupporting", variation: disabled ? "disabled" : focused ? "interactive" : "subdued" }, assistiveText))));
65
63
  }
@@ -95,12 +93,12 @@ function getMessage({ invalid, error, }) {
95
93
  messages.push(invalid);
96
94
  return messages.join("\n");
97
95
  }
98
- function Placeholder({ placeholder, styleOverride, labelVariation, miniLabelActive, }) {
96
+ function Placeholder({ placeholder, styleOverride, labelVariation, hasMiniLabel, }) {
99
97
  const typographyStyles = useTypographyStyles();
100
- return (React.createElement(React.Fragment, null, !styleOverride ? (React.createElement(Text, { hideFromScreenReader: true, maxLines: "single", variation: labelVariation, level: miniLabelActive ? "textSupporting" : "text" }, placeholder)) : (React.createElement(RNText, { accessibilityRole: "none", accessible: false, importantForAccessibility: "no-hide-descendants", numberOfLines: 1, style: [
98
+ return (React.createElement(React.Fragment, null, !styleOverride ? (React.createElement(Text, { hideFromScreenReader: true, maxLines: "single", variation: labelVariation, level: hasMiniLabel ? "textSupporting" : "text" }, placeholder)) : (React.createElement(RNText, { accessibilityRole: "none", accessible: false, importantForAccessibility: "no-hide-descendants", numberOfLines: 1, style: [
101
99
  typographyStyles[labelVariation],
102
100
  typographyStyles.baseRegularRegular,
103
- miniLabelActive
101
+ hasMiniLabel
104
102
  ? typographyStyles.smallSize
105
103
  : typographyStyles.defaultSize,
106
104
  styleOverride,
@@ -7,7 +7,7 @@ import { useTypographyStyles } from "../../../Typography";
7
7
  import { useStyles } from "../../InputFieldWrapper.style";
8
8
  export const prefixLabelTestId = "ATL-InputFieldWrapper-PrefixLabel";
9
9
  export const prefixIconTestId = "ATL-InputFieldWrapper-PrefixIcon";
10
- export function PrefixLabel({ focused, disabled, miniLabelActive, inputInvalid, label, styleOverride, }) {
10
+ export function PrefixLabel({ focused, disabled, hasMiniLabel, inputInvalid, label, styleOverride, }) {
11
11
  const styles = useStyles();
12
12
  const typographyStyles = useTypographyStyles();
13
13
  return (React.createElement(View, { style: [
@@ -15,10 +15,7 @@ export function PrefixLabel({ focused, disabled, miniLabelActive, inputInvalid,
15
15
  focused && styles.inputFocused,
16
16
  inputInvalid && styles.inputInvalid,
17
17
  ], testID: prefixLabelTestId },
18
- React.createElement(View, { style: [
19
- styles.prefixLabel,
20
- miniLabelActive && styles.fieldAffixMiniLabel,
21
- ] }, !styleOverride ? (React.createElement(Text, { variation: disabled ? "disabled" : "base" }, label)) : (React.createElement(RNText, { allowFontScaling: true, style: [
18
+ React.createElement(View, { style: [styles.prefixLabel, hasMiniLabel && styles.fieldAffixMiniLabel] }, !styleOverride ? (React.createElement(Text, { variation: disabled ? "disabled" : "base" }, label)) : (React.createElement(RNText, { allowFontScaling: true, style: [
22
19
  typographyStyles.baseRegularRegular,
23
20
  typographyStyles.base,
24
21
  typographyStyles.defaultSize,
@@ -7,7 +7,7 @@ import { useAtlantisTheme } from "../../../AtlantisThemeContext";
7
7
  import { useStyles } from "../../InputFieldWrapper.style";
8
8
  export const suffixLabelTestId = "ATL-InputFieldWrapper-SuffixLabel";
9
9
  export const suffixIconTestId = "ATL-InputFieldWrapper-SuffixIcon";
10
- export function SuffixLabel({ focused, disabled, miniLabelActive, inputInvalid, label, hasLeftMargin = true, styleOverride, }) {
10
+ export function SuffixLabel({ focused, disabled, hasMiniLabel, inputInvalid, label, hasLeftMargin = true, styleOverride, }) {
11
11
  const styles = useStyles();
12
12
  const typographyStyles = useTypographyStyles();
13
13
  return (React.createElement(View, { testID: suffixLabelTestId, style: [
@@ -16,10 +16,7 @@ export function SuffixLabel({ focused, disabled, miniLabelActive, inputInvalid,
16
16
  inputInvalid && styles.inputInvalid,
17
17
  hasLeftMargin && styles.suffixLabelMargin,
18
18
  ] },
19
- React.createElement(View, { style: [
20
- styles.suffixLabel,
21
- miniLabelActive && styles.fieldAffixMiniLabel,
22
- ] }, !styleOverride ? (React.createElement(Text, { variation: disabled ? "disabled" : "base" }, label)) : (React.createElement(RNText, { allowFontScaling: true, style: [
19
+ React.createElement(View, { style: [styles.suffixLabel, hasMiniLabel && styles.fieldAffixMiniLabel] }, !styleOverride ? (React.createElement(Text, { variation: disabled ? "disabled" : "base" }, label)) : (React.createElement(RNText, { allowFontScaling: true, style: [
23
20
  typographyStyles.baseRegularRegular,
24
21
  typographyStyles.base,
25
22
  typographyStyles.defaultSize,
@@ -1,12 +1,15 @@
1
- import React, { forwardRef } from "react";
1
+ import React, { forwardRef, useEffect, useState } from "react";
2
2
  import { Text as NativeText, Pressable } from "react-native";
3
3
  import { useShowClear } from "@jobber/hooks";
4
4
  import { useStyles } from "./InputPressable.style";
5
5
  import { InputFieldWrapper, useCommonInputStyles } from "../InputFieldWrapper";
6
6
  export const InputPressable = forwardRef(InputPressableInternal);
7
- export function InputPressableInternal({ value, placeholder, disabled, invalid, error, showMiniLabel = true, onPress, accessibilityLabel, accessibilityHint, prefix, suffix, clearable = "never", onClear, focused, }, ref) {
7
+ export function InputPressableInternal({ value, placeholder, disabled, invalid, error, onPress, accessibilityLabel, accessibilityHint, prefix, suffix, clearable = "never", onClear, focused, }, ref) {
8
8
  const hasValue = !!value;
9
- const placeholderMode = getPlaceholderMode(showMiniLabel, value);
9
+ const [hasMiniLabel, setHasMiniLabel] = useState(Boolean(value));
10
+ useEffect(() => {
11
+ setHasMiniLabel(Boolean(value));
12
+ }, [value]);
10
13
  const showClear = useShowClear({
11
14
  clearable,
12
15
  multiline: false,
@@ -16,28 +19,13 @@ export function InputPressableInternal({ value, placeholder, disabled, invalid,
16
19
  });
17
20
  const styles = useStyles();
18
21
  const commonInputStyles = useCommonInputStyles();
19
- return (React.createElement(InputFieldWrapper, { prefix: prefix, suffix: suffix, hasValue: hasValue, placeholderMode: placeholderMode, focused: focused, error: error, invalid: invalid, placeholder: placeholder, disabled: disabled, showClearAction: showClear, onClear: onClear },
22
+ return (React.createElement(InputFieldWrapper, { prefix: prefix, suffix: suffix, hasValue: hasValue, hasMiniLabel: hasMiniLabel, focused: focused, error: error, invalid: invalid, placeholder: placeholder, disabled: disabled, showClearAction: showClear, onClear: onClear },
20
23
  React.createElement(Pressable, { style: styles.pressable, onPress: onPress, disabled: disabled, accessibilityLabel: accessibilityLabel || placeholder, accessibilityHint: accessibilityHint, accessibilityValue: { text: value } },
21
24
  React.createElement(NativeText, { style: [
22
25
  commonInputStyles.input,
23
26
  styles.inputPressableStyles,
24
- placeholderMode === "normal" && commonInputStyles.inputEmpty,
25
- placeholderMode === "hidden" && styles.withoutMiniLabel,
27
+ !hasMiniLabel && commonInputStyles.inputEmpty,
26
28
  disabled && commonInputStyles.inputDisabled,
27
29
  (Boolean(invalid) || error) && styles.inputInvalid,
28
30
  ], testID: "inputPressableText", ref: ref, accessibilityRole: "none", accessible: false, importantForAccessibility: "no-hide-descendants" }, value))));
29
31
  }
30
- function getPlaceholderMode(isMiniLabelAllowed, internalValue) {
31
- const hasValue = Boolean(internalValue);
32
- if (hasValue) {
33
- if (isMiniLabelAllowed) {
34
- return "mini";
35
- }
36
- else {
37
- return "hidden";
38
- }
39
- }
40
- else {
41
- return "normal";
42
- }
43
- }
@@ -21,8 +21,5 @@ export const useStyles = buildThemedStyles(tokens => {
21
21
  inputInvalid: {
22
22
  borderColor: tokens["color-critical"],
23
23
  },
24
- withoutMiniLabel: {
25
- paddingTop: tokens["space-base"] + tokens["space-smallest"],
26
- },
27
24
  };
28
25
  });
@@ -9,7 +9,7 @@ import { InputFieldWrapper } from "../InputFieldWrapper";
9
9
  import { useCommonInputStyles } from "../InputFieldWrapper/CommonInputStyles.style";
10
10
  export const InputText = forwardRef(InputTextInternal);
11
11
  // eslint-disable-next-line max-statements
12
- function InputTextInternal({ invalid, disabled, readonly = false, name, placeholder, assistiveText, showMiniLabel = true, keyboard, value: controlledValue, defaultValue, autoFocus, autoComplete = "off", spellCheck, textContentType = "none", validations, onChangeText, onSubmitEditing, onFocus, accessibilityLabel, accessibilityHint, autoCorrect, autoCapitalize, onBlur, multiline = false, prefix, suffix, transform = {}, clearable = multiline ? "never" : "while-editing", testID, secureTextEntry, styleOverride, toolbar, toolbarVisibility, loading, loadingType, }, ref) {
12
+ function InputTextInternal({ invalid, disabled, readonly = false, name, placeholder, assistiveText, keyboard, value: controlledValue, defaultValue, autoFocus, autoComplete = "off", spellCheck, textContentType = "none", validations, onChangeText, onSubmitEditing, onFocus, accessibilityLabel, accessibilityHint, autoCorrect, autoCapitalize, onBlur, multiline = false, prefix, suffix, transform = {}, clearable = multiline ? "never" : "while-editing", testID, secureTextEntry, styleOverride, toolbar, toolbarVisibility, loading, loadingType, }, ref) {
13
13
  var _a;
14
14
  const isAndroid = Platform.OS === "android";
15
15
  const isIOS = Platform.OS === "ios";
@@ -22,8 +22,7 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
22
22
  const internalValue = controlledValue !== null && controlledValue !== void 0 ? controlledValue : (_a = field.value) === null || _a === void 0 ? void 0 : _a.toString();
23
23
  const hasValue = internalValue !== "" && internalValue !== undefined;
24
24
  const [focused, setFocused] = useState(false);
25
- const placeholderMode = getPlaceholderMode(showMiniLabel, internalValue);
26
- const miniLabelActive = placeholderMode === "mini";
25
+ const { hasMiniLabel } = useMiniLabel(internalValue);
27
26
  const textInputRef = useTextInputRef({ ref, onClear: handleClear });
28
27
  const showClear = useShowClear({
29
28
  clearable,
@@ -75,18 +74,15 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
75
74
  }
76
75
  const styles = useStyles();
77
76
  const commonInputStyles = useCommonInputStyles();
78
- return (React.createElement(InputFieldWrapper, { prefix: prefix, suffix: suffix, hasValue: hasValue, placeholderMode: placeholderMode, assistiveText: assistiveText, focused: focused, error: error, invalid: invalid, placeholder: placeholder, disabled: disabled, onClear: handleClear, showClearAction: showClear, styleOverride: styleOverride, toolbar: toolbar, toolbarVisibility: toolbarVisibility, loading: loading, loadingType: loadingType },
77
+ return (React.createElement(InputFieldWrapper, { prefix: prefix, suffix: suffix, hasValue: hasValue, hasMiniLabel: hasMiniLabel, assistiveText: assistiveText, focused: focused, error: error, invalid: invalid, placeholder: placeholder, disabled: disabled, onClear: handleClear, showClearAction: showClear, styleOverride: styleOverride, toolbar: toolbar, toolbarVisibility: toolbarVisibility, loading: loading, loadingType: loadingType },
79
78
  React.createElement(TextInput, Object.assign({ inputAccessoryViewID: inputAccessoryID || undefined, testID: testID, autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, spellCheck: spellCheck, style: [
80
79
  commonInputStyles.input,
81
80
  styles.inputPaddingTop,
82
- !miniLabelActive && commonInputStyles.inputEmpty,
81
+ !hasMiniLabel && commonInputStyles.inputEmpty,
83
82
  disabled && commonInputStyles.inputDisabled,
84
83
  multiline && styles.multiLineInput,
85
84
  multiline && Platform.OS === "ios" && styles.multilineInputiOS,
86
- multiline && miniLabelActive && styles.multiLineInputWithMini,
87
- multiline &&
88
- placeholderMode === "hidden" &&
89
- styles.multilineWithoutMiniLabel,
85
+ multiline && hasMiniLabel && styles.multiLineInputWithMini,
90
86
  styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.inputText,
91
87
  loading && loadingType === "glimmer" && { color: "transparent" },
92
88
  ], readOnly: readonly, editable: !disabled, keyboardType: keyboard, value: inputTransform(internalValue), autoFocus: autoFocus, autoComplete: autoComplete, multiline: multiline, scrollEnabled: false, textContentType: textContentType, onChangeText: handleChangeText, onSubmitEditing: handleOnSubmitEditing, returnKeyType: returnKeyType, blurOnSubmit: shouldBlurOnSubmit, accessibilityLabel: accessibilityLabel || placeholder, accessibilityHint: accessibilityHint, accessibilityState: { busy: loading }, secureTextEntry: secureTextEntry }, androidA11yProps, { onFocus: event => {
@@ -153,17 +149,10 @@ function useTextInputRef({ ref, onClear }) {
153
149
  }), [onClear]);
154
150
  return textInputRef;
155
151
  }
156
- function getPlaceholderMode(isMiniLabelAllowed, internalValue) {
157
- const hasValue = Boolean(internalValue);
158
- if (hasValue) {
159
- if (isMiniLabelAllowed) {
160
- return "mini";
161
- }
162
- else {
163
- return "hidden";
164
- }
165
- }
166
- else {
167
- return "normal";
168
- }
152
+ function useMiniLabel(internalValue) {
153
+ const [hasMiniLabel, setHasMiniLabel] = useState(Boolean(internalValue));
154
+ useEffect(() => {
155
+ setHasMiniLabel(Boolean(internalValue));
156
+ }, [internalValue]);
157
+ return { hasMiniLabel };
169
158
  }
@@ -20,9 +20,5 @@ export const useStyles = buildThemedStyles(tokens => {
20
20
  multilineInputiOS: {
21
21
  paddingTop: (typographyStyles.defaultSize.fontSize || 0) + tokens["space-smallest"],
22
22
  },
23
- multilineWithoutMiniLabel: {
24
- paddingTop: tokens["space-base"] + tokens["space-smallest"],
25
- paddingBottom: tokens["space-base"] + tokens["space-smallest"],
26
- },
27
23
  };
28
24
  });
@@ -28,7 +28,7 @@ export function InputTime(props) {
28
28
  }
29
29
  return React.createElement(InternalInputTime, Object.assign({}, props));
30
30
  }
31
- function InternalInputTime({ clearable = "always", disabled, emptyValueLabel, invalid, placeholder, value, name, type = "scheduling", showMiniLabel = true, onChange, showIcon = true, }) {
31
+ function InternalInputTime({ clearable = "always", disabled, emptyValueLabel, invalid, placeholder, value, name, type = "scheduling", onChange, showIcon = true, }) {
32
32
  const [showPicker, setShowPicker] = useState(false);
33
33
  const { t, formatTime } = useAtlantisI18n();
34
34
  const { timeZone, timeFormat } = useAtlantisContext();
@@ -42,7 +42,7 @@ function InternalInputTime({ clearable = "always", disabled, emptyValueLabel, in
42
42
  }, [dateTime, emptyValueLabel]);
43
43
  const canClearTime = formattedTime === emptyValueLabel ? "never" : clearable;
44
44
  return (React.createElement(View, { style: styles.container },
45
- React.createElement(InputPressable, { showMiniLabel: showMiniLabel, clearable: canClearTime, disabled: disabled, invalid: invalid, focused: showPicker, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t("time"), prefix: showIcon ? { icon: "timer" } : undefined, value: formattedTime, onClear: handleClear, onPress: showDatePicker }),
45
+ React.createElement(InputPressable, { clearable: canClearTime, disabled: disabled, invalid: invalid, focused: showPicker, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t("time"), prefix: showIcon ? { icon: "timer" } : undefined, value: formattedTime, onClear: handleClear, onPress: showDatePicker }),
46
46
  React.createElement(DateTimePicker, { testID: "inputTime-Picker", minuteInterval: getMinuteInterval(type), date: getInitialPickerDate(dateTime), timeZoneOffsetInMinutes: getTimeZoneOffsetInMinutes(timeZone, dateTime), isVisible: showPicker, mode: "time", onCancel: handleCancel, onConfirm: handleConfirm, is24Hour: is24Hour, locale: is24Hour ? LOCALE_24_HOURS : LOCALE_12_HOURS })));
47
47
  function showDatePicker() {
48
48
  Keyboard.dismiss();