@butternutbox/pawprint-native 0.10.6 → 0.10.7

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.
@@ -9,10 +9,10 @@
9
9
  DTS Build start
10
10
  ESM dist/index.js 1.72 MB
11
11
  ESM dist/index.js.map 2.69 MB
12
- ESM ⚡️ Build success in 11138ms
13
- CJS dist/index.cjs 1.79 MB
14
- CJS dist/index.cjs.map 2.69 MB
15
- CJS ⚡️ Build success in 11141ms
16
- DTS ⚡️ Build success in 22119ms
17
- DTS dist/index.d.cts 91.30 KB
18
- DTS dist/index.d.ts 91.30 KB
12
+ ESM ⚡️ Build success in 11806ms
13
+ CJS dist/index.cjs 1.80 MB
14
+ CJS dist/index.cjs.map 2.70 MB
15
+ CJS ⚡️ Build success in 11807ms
16
+ DTS ⚡️ Build success in 24924ms
17
+ DTS dist/index.d.cts 91.44 KB
18
+ DTS dist/index.d.ts 91.44 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @butternutbox/pawprint-native
2
2
 
3
+ ## 0.10.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 7af3414: add inline help text to number fields
8
+
3
9
  ## 0.10.6
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -4837,7 +4837,10 @@ var StyledInputWrapper = styled50__default.default(reactNative.Animated.View)(({
4837
4837
  flexShrink: containerWidth !== void 0 ? 0 : void 0
4838
4838
  };
4839
4839
  });
4840
- var StyledInput = styled50__default.default(reactNative.TextInput)(({ theme: theme2 }) => {
4840
+ var StyledInput = styled50__default.default(reactNative.TextInput)(({
4841
+ theme: theme2,
4842
+ hasInlineHelp
4843
+ }) => {
4841
4844
  var _a, _b;
4842
4845
  const { colour, field } = theme2.tokens.components.inputs;
4843
4846
  const typography = field.placeholder.default;
@@ -4847,7 +4850,7 @@ var StyledInput = styled50__default.default(reactNative.TextInput)(({ theme: the
4847
4850
  );
4848
4851
  const fontSize = parseTokenValue12(typography.fontSize);
4849
4852
  const letterSpacing = ((_a = typography.letterSpacing) == null ? void 0 : _a.endsWith("%")) ? parseFloat(typography.letterSpacing) / 100 * fontSize : parseFloat((_b = typography.letterSpacing) != null ? _b : "0");
4850
- return __spreadValues({
4853
+ return __spreadValues(__spreadValues({
4851
4854
  flex: 1,
4852
4855
  minWidth: 0,
4853
4856
  minHeight: 0,
@@ -4856,7 +4859,7 @@ var StyledInput = styled50__default.default(reactNative.TextInput)(({ theme: the
4856
4859
  fontFamily,
4857
4860
  fontSize,
4858
4861
  letterSpacing
4859
- }, {
4862
+ }, hasInlineHelp ? { position: "relative", top: -8 } : {}), {
4860
4863
  outlineStyle: "none",
4861
4864
  outlineWidth: 0,
4862
4865
  outlineColor: "transparent"
@@ -4881,6 +4884,7 @@ var InputField = React65__default.default.forwardRef(
4881
4884
  hideStateIcons,
4882
4885
  containerWidth,
4883
4886
  containerHeight,
4887
+ hasInlineHelp,
4884
4888
  style,
4885
4889
  editable,
4886
4890
  onFocus,
@@ -4893,6 +4897,7 @@ var InputField = React65__default.default.forwardRef(
4893
4897
  "hideStateIcons",
4894
4898
  "containerWidth",
4895
4899
  "containerHeight",
4900
+ "hasInlineHelp",
4896
4901
  "style",
4897
4902
  "editable",
4898
4903
  "onFocus",
@@ -5015,7 +5020,8 @@ var InputField = React65__default.default.forwardRef(
5015
5020
  placeholderTextColor: colour.field.text.placeholder,
5016
5021
  editable,
5017
5022
  onFocus: handleFocus,
5018
- onBlur: handleBlur
5023
+ onBlur: handleBlur,
5024
+ hasInlineHelp
5019
5025
  }, rest)
5020
5026
  ),
5021
5027
  trailingIcon && /* @__PURE__ */ jsxRuntime.jsx(StyledIconSlot, { children: trailingIcon }),
@@ -7766,8 +7772,12 @@ var StyledFieldTextWrapper = styled50__default.default(reactNative.View)({
7766
7772
  flexShrink: 0,
7767
7773
  justifyContent: "center"
7768
7774
  });
7775
+ var StyledInputContainer = styled50__default.default(reactNative.View)(({ hasInlineHelp }) => ({
7776
+ flexDirection: "column",
7777
+ gap: hasInlineHelp ? 2 : 0
7778
+ }));
7769
7779
  var NumberInputField = React65__default.default.forwardRef((_a, ref) => {
7770
- var _b = _a, { fieldText } = _b, props = __objRest(_b, ["fieldText"]);
7780
+ var _b = _a, { fieldText, inlineHelpText } = _b, props = __objRest(_b, ["fieldText", "inlineHelpText"]);
7771
7781
  const theme2 = react.useTheme();
7772
7782
  const { colour, description } = theme2.tokens.components.inputs;
7773
7783
  const fieldSize = parseTokenValue14(
@@ -7779,15 +7789,47 @@ var NumberInputField = React65__default.default.forwardRef((_a, ref) => {
7779
7789
  keyboardType: "numeric",
7780
7790
  hideStateIcons: true,
7781
7791
  containerWidth: fieldSize,
7782
- containerHeight: fieldSize,
7792
+ containerHeight: inlineHelpText ? void 0 : fieldSize,
7793
+ hasInlineHelp: !!inlineHelpText,
7783
7794
  ref,
7784
7795
  style: { textAlign: "center" }
7785
7796
  }, props)
7786
7797
  );
7787
- if (!fieldText) {
7788
- return inputElement;
7789
- }
7790
- return /* @__PURE__ */ jsxRuntime.jsxs(StyledFieldGroup, { children: [
7798
+ const fieldContent = inlineHelpText && fieldText ? /* @__PURE__ */ jsxRuntime.jsxs(StyledFieldGroup, { children: [
7799
+ /* @__PURE__ */ jsxRuntime.jsxs(StyledInputContainer, { hasInlineHelp: true, children: [
7800
+ inputElement,
7801
+ /* @__PURE__ */ jsxRuntime.jsx(
7802
+ reactNative.View,
7803
+ {
7804
+ style: {
7805
+ position: "absolute",
7806
+ bottom: 4,
7807
+ left: 0,
7808
+ width: fieldSize,
7809
+ display: "flex",
7810
+ justifyContent: "center",
7811
+ alignItems: "center"
7812
+ },
7813
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7814
+ Typography,
7815
+ {
7816
+ token: description.text.default,
7817
+ color: colour.description.default,
7818
+ children: inlineHelpText
7819
+ }
7820
+ )
7821
+ }
7822
+ )
7823
+ ] }),
7824
+ /* @__PURE__ */ jsxRuntime.jsx(StyledFieldTextWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(
7825
+ Typography,
7826
+ {
7827
+ token: description.text.default,
7828
+ color: colour.description.default,
7829
+ children: fieldText
7830
+ }
7831
+ ) })
7832
+ ] }) : fieldText ? /* @__PURE__ */ jsxRuntime.jsxs(StyledFieldGroup, { children: [
7791
7833
  inputElement,
7792
7834
  /* @__PURE__ */ jsxRuntime.jsx(StyledFieldTextWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(
7793
7835
  Typography,
@@ -7797,7 +7839,31 @@ var NumberInputField = React65__default.default.forwardRef((_a, ref) => {
7797
7839
  children: fieldText
7798
7840
  }
7799
7841
  ) })
7800
- ] });
7842
+ ] }) : inlineHelpText ? /* @__PURE__ */ jsxRuntime.jsxs(StyledInputContainer, { hasInlineHelp: true, children: [
7843
+ inputElement,
7844
+ /* @__PURE__ */ jsxRuntime.jsx(
7845
+ reactNative.View,
7846
+ {
7847
+ style: {
7848
+ position: "absolute",
7849
+ bottom: 4,
7850
+ width: fieldSize,
7851
+ display: "flex",
7852
+ justifyContent: "center",
7853
+ alignItems: "center"
7854
+ },
7855
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7856
+ Typography,
7857
+ {
7858
+ token: description.text.default,
7859
+ color: colour.description.default,
7860
+ children: inlineHelpText
7861
+ }
7862
+ )
7863
+ }
7864
+ )
7865
+ ] }) : inputElement;
7866
+ return fieldContent;
7801
7867
  });
7802
7868
  NumberInputField.displayName = "NumberInput.Field";
7803
7869
  var parseTokenValue15 = (value) => parseFloat(value);
@@ -7817,6 +7883,7 @@ var NumberInputRoot = React65__default.default.forwardRef(
7817
7883
  optionalText,
7818
7884
  onValueChange,
7819
7885
  fieldText,
7886
+ inlineHelpText,
7820
7887
  children
7821
7888
  } = _b, inputProps = __objRest(_b, [
7822
7889
  "label",
@@ -7826,6 +7893,7 @@ var NumberInputRoot = React65__default.default.forwardRef(
7826
7893
  "optionalText",
7827
7894
  "onValueChange",
7828
7895
  "fieldText",
7896
+ "inlineHelpText",
7829
7897
  "children"
7830
7898
  ]);
7831
7899
  if (children) {
@@ -7838,7 +7906,8 @@ var NumberInputRoot = React65__default.default.forwardRef(
7838
7906
  __spreadValues({
7839
7907
  state,
7840
7908
  onChangeText: onValueChange,
7841
- fieldText
7909
+ fieldText,
7910
+ inlineHelpText
7842
7911
  }, inputProps)
7843
7912
  ),
7844
7913
  description && /* @__PURE__ */ jsxRuntime.jsx(InputDescription, { state, children: description }),
@@ -10223,6 +10292,7 @@ var StyledFieldWrapper = styled50__default.default(reactNative.View)(
10223
10292
  }) => __spreadValues({
10224
10293
  alignItems: "center",
10225
10294
  justifyContent: "center",
10295
+ position: "relative",
10226
10296
  width: fullWidth ? "100%" : fieldMinWidth,
10227
10297
  minWidth: fieldMinWidth,
10228
10298
  height: fieldHeight,
@@ -10234,19 +10304,27 @@ var StyledFieldWrapper = styled50__default.default(reactNative.View)(
10234
10304
  overflow: "hidden"
10235
10305
  }, fullWidth && { flex: 1 })
10236
10306
  );
10237
- var StyledTextInput = styled50__default.default(reactNative.TextInput)(({ inputColor, inputFontFamily, inputFontWeight, inputFontSize }) => __spreadProps(__spreadValues({
10238
- textAlign: "center",
10239
- outlineStyle: "none",
10240
- padding: 0,
10241
- minWidth: 0,
10242
- minHeight: 0,
10243
- width: "100%",
10244
- height: "100%",
10245
- color: inputColor,
10246
- fontFamily: inputFontFamily
10247
- }, inputFontWeight ? { fontWeight: inputFontWeight } : {}), {
10248
- fontSize: inputFontSize
10249
- }));
10307
+ var StyledTextInput = styled50__default.default(reactNative.TextInput)(
10308
+ ({
10309
+ inputColor,
10310
+ inputFontFamily,
10311
+ inputFontWeight,
10312
+ inputFontSize,
10313
+ hasInlineHelp
10314
+ }) => __spreadValues(__spreadProps(__spreadValues({
10315
+ textAlign: "center",
10316
+ outlineStyle: "none",
10317
+ padding: 0,
10318
+ minWidth: 0,
10319
+ minHeight: 0,
10320
+ width: "100%",
10321
+ height: "100%",
10322
+ color: inputColor,
10323
+ fontFamily: inputFontFamily
10324
+ }, inputFontWeight ? { fontWeight: inputFontWeight } : {}), {
10325
+ fontSize: inputFontSize
10326
+ }), hasInlineHelp ? { position: "relative", top: -8 } : {})
10327
+ );
10250
10328
  var StyledRow = styled50__default.default(reactNative.View)(({ rowGap }) => ({
10251
10329
  flexDirection: "row",
10252
10330
  alignItems: "center",
@@ -10267,6 +10345,7 @@ var NumberFieldInput = React65__default.default.forwardRef(
10267
10345
  decrementDisabled = false,
10268
10346
  min,
10269
10347
  max,
10348
+ inlineHelpText,
10270
10349
  style,
10271
10350
  onFocus,
10272
10351
  onBlur,
@@ -10286,6 +10365,7 @@ var NumberFieldInput = React65__default.default.forwardRef(
10286
10365
  "decrementDisabled",
10287
10366
  "min",
10288
10367
  "max",
10368
+ "inlineHelpText",
10289
10369
  "style",
10290
10370
  "onFocus",
10291
10371
  "onBlur",
@@ -10364,7 +10444,7 @@ var NumberFieldInput = React65__default.default.forwardRef(
10364
10444
  disabled: disabled || decrementDisabled || isAtMin
10365
10445
  }
10366
10446
  ),
10367
- /* @__PURE__ */ jsxRuntime.jsx(
10447
+ /* @__PURE__ */ jsxRuntime.jsxs(
10368
10448
  StyledFieldWrapper,
10369
10449
  {
10370
10450
  fieldBgColor: tokens3.colour.field.background.default,
@@ -10374,24 +10454,48 @@ var NumberFieldInput = React65__default.default.forwardRef(
10374
10454
  fieldHeight,
10375
10455
  fieldPaddingHorizontal,
10376
10456
  fullWidth,
10377
- children: /* @__PURE__ */ jsxRuntime.jsx(
10378
- StyledTextInput,
10379
- __spreadValues({
10380
- ref,
10381
- inputColor: tokens3.colour.field.text.default,
10382
- inputFontFamily: resolvedInputFontFamily,
10383
- inputFontWeight: resolvedInputFontFamily === typographyToken.fontFamily ? typographyToken.fontWeight : void 0,
10384
- inputFontSize: parseTokenValue34(typographyToken.fontSize),
10385
- keyboardType: "numeric",
10386
- editable: !disabled,
10387
- onFocus: handleFocus,
10388
- onBlur: handleBlur,
10389
- onChangeText: handleChangeText,
10390
- defaultValue,
10391
- value,
10392
- style
10393
- }, rest)
10394
- )
10457
+ children: [
10458
+ /* @__PURE__ */ jsxRuntime.jsx(
10459
+ StyledTextInput,
10460
+ __spreadValues({
10461
+ ref,
10462
+ inputColor: tokens3.colour.field.text.default,
10463
+ inputFontFamily: resolvedInputFontFamily,
10464
+ inputFontWeight: resolvedInputFontFamily === typographyToken.fontFamily ? typographyToken.fontWeight : void 0,
10465
+ inputFontSize: parseTokenValue34(typographyToken.fontSize),
10466
+ hasInlineHelp: !!inlineHelpText,
10467
+ keyboardType: "numeric",
10468
+ editable: !disabled,
10469
+ onFocus: handleFocus,
10470
+ onBlur: handleBlur,
10471
+ onChangeText: handleChangeText,
10472
+ defaultValue,
10473
+ value,
10474
+ style
10475
+ }, rest)
10476
+ ),
10477
+ inlineHelpText && /* @__PURE__ */ jsxRuntime.jsx(
10478
+ reactNative.View,
10479
+ {
10480
+ style: {
10481
+ position: "absolute",
10482
+ bottom: 4,
10483
+ width: fieldMinWidth,
10484
+ display: "flex",
10485
+ justifyContent: "center",
10486
+ alignItems: "center"
10487
+ },
10488
+ children: /* @__PURE__ */ jsxRuntime.jsx(
10489
+ Typography,
10490
+ {
10491
+ token: inputTokens3.description.text.default,
10492
+ color: inputTokens3.colour.description.default,
10493
+ children: inlineHelpText
10494
+ }
10495
+ )
10496
+ }
10497
+ )
10498
+ ]
10395
10499
  }
10396
10500
  ),
10397
10501
  showIncrementButton && /* @__PURE__ */ jsxRuntime.jsx(