@hoddy-ui/next 2.5.90 → 2.5.92
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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +38 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -226,6 +226,8 @@ interface TextFieldProps extends TextInputProps {
|
|
|
226
226
|
onFocus?: () => void;
|
|
227
227
|
onBlur?: () => void;
|
|
228
228
|
selectMenuProps?: Partial<SelectMenuProps>;
|
|
229
|
+
/** When true (default), floating label is in open state when placeholder is set. When false, label only opens on focus or when value is set. */
|
|
230
|
+
openLabelWithPlaceholder?: boolean;
|
|
229
231
|
}
|
|
230
232
|
interface TypographyProps extends TextProps {
|
|
231
233
|
children: ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -226,6 +226,8 @@ interface TextFieldProps extends TextInputProps {
|
|
|
226
226
|
onFocus?: () => void;
|
|
227
227
|
onBlur?: () => void;
|
|
228
228
|
selectMenuProps?: Partial<SelectMenuProps>;
|
|
229
|
+
/** When true (default), floating label is in open state when placeholder is set. When false, label only opens on focus or when value is set. */
|
|
230
|
+
openLabelWithPlaceholder?: boolean;
|
|
229
231
|
}
|
|
230
232
|
interface TypographyProps extends TextProps {
|
|
231
233
|
children: ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -143,6 +143,30 @@ function colors(theme) {
|
|
|
143
143
|
text: "#ffffff",
|
|
144
144
|
...extraColors?.light?.primary,
|
|
145
145
|
...extraColors?.dark?.primary
|
|
146
|
+
},
|
|
147
|
+
error: {
|
|
148
|
+
...extraColors?.light?.error,
|
|
149
|
+
...extraColors?.dark?.error
|
|
150
|
+
},
|
|
151
|
+
secondary: {
|
|
152
|
+
...extraColors?.light?.secondary,
|
|
153
|
+
...extraColors?.dark?.secondary
|
|
154
|
+
},
|
|
155
|
+
warning: {
|
|
156
|
+
...extraColors?.light?.warning,
|
|
157
|
+
...extraColors?.dark?.warning
|
|
158
|
+
},
|
|
159
|
+
success: {
|
|
160
|
+
...extraColors?.light?.success,
|
|
161
|
+
...extraColors?.dark?.success
|
|
162
|
+
},
|
|
163
|
+
info: {
|
|
164
|
+
...extraColors?.light?.info,
|
|
165
|
+
...extraColors?.dark?.info
|
|
166
|
+
},
|
|
167
|
+
blue: {
|
|
168
|
+
...extraColors?.light?.blue,
|
|
169
|
+
...extraColors?.dark?.blue
|
|
146
170
|
}
|
|
147
171
|
};
|
|
148
172
|
const dynamicColors = theme === "dark" ? darkColors : lightColors;
|
|
@@ -1601,9 +1625,11 @@ var TextFieldBase = import_react16.default.forwardRef(
|
|
|
1601
1625
|
options,
|
|
1602
1626
|
multiline,
|
|
1603
1627
|
selectMenuProps,
|
|
1628
|
+
openLabelWithPlaceholder = true,
|
|
1604
1629
|
...props
|
|
1605
1630
|
}, ref) => {
|
|
1606
1631
|
const colors2 = useColors();
|
|
1632
|
+
const theme = useTheme();
|
|
1607
1633
|
const [focused, _setFocused] = (0, import_react16.useState)(false);
|
|
1608
1634
|
const [showPassword, setShowPassword] = (0, import_react16.useState)(false);
|
|
1609
1635
|
const [datePickerVisible, setDatePickerVisible] = (0, import_react16.useState)(false);
|
|
@@ -1618,7 +1644,7 @@ var TextFieldBase = import_react16.default.forwardRef(
|
|
|
1618
1644
|
};
|
|
1619
1645
|
const isFloating = labelVariant === "floating";
|
|
1620
1646
|
const hasPlaceholder = placeholder != null && String(placeholder).trim() !== "";
|
|
1621
|
-
const labelOpen = focused || value || isFloating && hasPlaceholder;
|
|
1647
|
+
const labelOpen = focused || value || isFloating && hasPlaceholder && openLabelWithPlaceholder;
|
|
1622
1648
|
const baseHeight = (0, import_react_native_size_matters13.moderateScale)(
|
|
1623
1649
|
multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
|
|
1624
1650
|
);
|
|
@@ -1720,13 +1746,13 @@ var TextFieldBase = import_react16.default.forwardRef(
|
|
|
1720
1746
|
position: "absolute",
|
|
1721
1747
|
left: inputPadding,
|
|
1722
1748
|
fontSize: labelOpen ? "10@s" : "13@s",
|
|
1723
|
-
color: error ? colors2.error.main : focused ? colors2[color].main : colors2.textSecondary.main
|
|
1749
|
+
color: error ? colors2.error.main : focused ? theme === "dark" ? colors2[color].light : colors2[color].main : colors2.textSecondary.main
|
|
1724
1750
|
}
|
|
1725
1751
|
} : {},
|
|
1726
1752
|
helperText: {
|
|
1727
1753
|
paddingHorizontal: "15@s",
|
|
1728
1754
|
flex: 1,
|
|
1729
|
-
color: focused ? colors2[color].main : colors2.textSecondary.main,
|
|
1755
|
+
color: error ? colors2.error.main : focused ? theme === "dark" ? colors2[color].light : colors2[color].main : colors2.textSecondary.main,
|
|
1730
1756
|
paddingTop: "4@ms"
|
|
1731
1757
|
},
|
|
1732
1758
|
error: {
|
|
@@ -1935,7 +1961,15 @@ var TextFieldBase = import_react16.default.forwardRef(
|
|
|
1935
1961
|
}
|
|
1936
1962
|
)
|
|
1937
1963
|
) : null
|
|
1938
|
-
), helperText ? /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.helperText, variant: "caption" }, helperText) : null, error ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.error }, /* @__PURE__ */ import_react16.default.createElement(import_vector_icons8.MaterialIcons, { name: "error", color: colors2.error.main, size: 16 }), /* @__PURE__ */ import_react16.default.createElement(
|
|
1964
|
+
), helperText ? /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.helperText, variant: "caption" }, helperText) : null, error ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.error }, /* @__PURE__ */ import_react16.default.createElement(import_vector_icons8.MaterialIcons, { name: "error", color: colors2.error.main, size: 16 }), /* @__PURE__ */ import_react16.default.createElement(
|
|
1965
|
+
Typography_default,
|
|
1966
|
+
{
|
|
1967
|
+
style: styles.errorText,
|
|
1968
|
+
color: "error",
|
|
1969
|
+
fontWeight: 400
|
|
1970
|
+
},
|
|
1971
|
+
error
|
|
1972
|
+
)) : null), options ? /* @__PURE__ */ import_react16.default.createElement(
|
|
1939
1973
|
SelectMenu_default,
|
|
1940
1974
|
{
|
|
1941
1975
|
options,
|