@jobber/components 8.9.1 → 8.10.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/Icon-cjs.js CHANGED
@@ -15,7 +15,8 @@ function Icon({ name, color, customColor, size = "base", testID, UNSAFE_classNam
15
15
  icon = getTruck(pathStyle, customColor);
16
16
  }
17
17
  else {
18
- icon = paths.map((path) => (React.createElement("path", { key: path, style: Object.assign(Object.assign({}, pathStyle), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.path), className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.path, d: path, fill: customColor })));
18
+ // getIcon returns undefined paths for an unknown icon name; render nothing rather than crash.
19
+ icon = (paths !== null && paths !== void 0 ? paths : []).map((path) => (React.createElement("path", { key: path, style: Object.assign(Object.assign({}, pathStyle), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.path), className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.path, d: path, fill: customColor })));
19
20
  }
20
21
  return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: viewBox, style: Object.assign(Object.assign({}, svgStyle), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.svg), className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.svg, "data-testid": testID || name }, icon));
21
22
  }
package/dist/Icon-es.js CHANGED
@@ -13,7 +13,8 @@ function Icon({ name, color, customColor, size = "base", testID, UNSAFE_classNam
13
13
  icon = getTruck(pathStyle, customColor);
14
14
  }
15
15
  else {
16
- icon = paths.map((path) => (React__default.createElement("path", { key: path, style: Object.assign(Object.assign({}, pathStyle), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.path), className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.path, d: path, fill: customColor })));
16
+ // getIcon returns undefined paths for an unknown icon name; render nothing rather than crash.
17
+ icon = (paths !== null && paths !== void 0 ? paths : []).map((path) => (React__default.createElement("path", { key: path, style: Object.assign(Object.assign({}, pathStyle), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.path), className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.path, d: path, fill: customColor })));
17
18
  }
18
19
  return (React__default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: viewBox, style: Object.assign(Object.assign({}, svgStyle), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.svg), className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.svg, "data-testid": testID || name }, icon));
19
20
  }
@@ -610,7 +610,8 @@ if (process.env.NODE_ENV !== "production") FieldDescription.displayName = "Field
610
610
  var styles = {"container":"_6HZLFIOZh4s-","inline":"_-6ndFYNKKaM-","wrapper":"c20czk-FSyY-","disabled":"_-2INirAxaU4-","small":"NsFBA5oqRAA-","large":"ExKqck-6xVs-","center":"UWiqNi57G8g-","right":"po25PZwJpe4-","inputWrapper":"k9dAO6d010o-","input":"D-PmE-l-hZU-","stepper":"t42w4ZDiDyI-","label":"Ggk3aaMcIJU-","hideLabel":"C7d6qmoZiKU-","affixLabel":"_4u1JHjUYvkY-","prefix":"rEWH41rUUEE-","suffix":"_4-iNl6jdfmM-","affixIcon":"_5-Iw-2c-wXk-","compoundAffix":"tZjZRRcAShY-","affixLabelText":"mbEcqyBQoEg-","stepperButton":"zzrCzYF-8u0-","belowField":"_0mcAZAtwQ2o-","description":"xxp2uGc-B6o-","fieldError":"q-WsOi6joGo-","spinning":"d0TEiLWObKU-"};
611
611
 
612
612
  /**
613
- * Preserve user-typed decimals on blur. Without `maximumFractionDigits: 20`,
613
+ * Default formatting used only when the consumer does not pass `format`.
614
+ * Preserves user-typed decimals on blur: without `maximumFractionDigits: 20`,
614
615
  * `Intl.NumberFormat` rounds to 3 digits and silently truncates input.
615
616
  */
616
617
  const DEFAULT_FORMAT = {
@@ -627,7 +628,7 @@ function useInputNumberExperimentalContext(consumer) {
627
628
  }
628
629
  // eslint-disable-next-line max-statements
629
630
  function InputNumberExperimentalInternal(props, ref) {
630
- const { align, autocomplete, children, description, disabled, error, id: idProp, inline, invalid, keyboard, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", suffix, value, } = props;
631
+ const { align, autocomplete, children, description, disabled, error, format, id: idProp, inline, invalid, keyboard, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", suffix, value, } = props;
631
632
  const generatedId = React.useId();
632
633
  const id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
633
634
  const innerInputRef = React.useRef(null);
@@ -702,7 +703,7 @@ function InputNumberExperimentalInternal(props, ref) {
702
703
  const fieldInvalid = invalid || Boolean(error);
703
704
  return (React.createElement(FieldRoot, { className: classnames(styles.container, inline && styles.inline), disabled: disabled, invalid: fieldInvalid, name: name },
704
705
  React.createElement(InputNumberExperimentalContext.Provider, { value: contextValue },
705
- React.createElement(NumberFieldInput.NumberFieldRoot, { allowOutOfRange: true, format: DEFAULT_FORMAT, id: id, max: max, min: min, onValueChange: handleValueChange, onValueCommitted: handleValueCommitted, readOnly: readonly, value: value !== null && value !== void 0 ? value : null },
706
+ React.createElement(NumberFieldInput.NumberFieldRoot, { allowOutOfRange: true, format: format !== null && format !== void 0 ? format : DEFAULT_FORMAT, id: id, max: max, min: min, onValueChange: handleValueChange, onValueCommitted: handleValueCommitted, readOnly: readonly, value: value !== null && value !== void 0 ? value : null },
706
707
  React.createElement(NumberFieldInput.NumberFieldGroup, { className: classnames(styles.wrapper, align && styles[align], disabled && styles.disabled, size !== "default" && styles[size]) }, isUsingCompoundPattern
707
708
  ? children
708
709
  : renderDefaultComposition({ prefix, suffix, size })))),
@@ -590,7 +590,8 @@ if (process.env.NODE_ENV !== "production") FieldDescription.displayName = "Field
590
590
  var styles = {"container":"_6HZLFIOZh4s-","inline":"_-6ndFYNKKaM-","wrapper":"c20czk-FSyY-","disabled":"_-2INirAxaU4-","small":"NsFBA5oqRAA-","large":"ExKqck-6xVs-","center":"UWiqNi57G8g-","right":"po25PZwJpe4-","inputWrapper":"k9dAO6d010o-","input":"D-PmE-l-hZU-","stepper":"t42w4ZDiDyI-","label":"Ggk3aaMcIJU-","hideLabel":"C7d6qmoZiKU-","affixLabel":"_4u1JHjUYvkY-","prefix":"rEWH41rUUEE-","suffix":"_4-iNl6jdfmM-","affixIcon":"_5-Iw-2c-wXk-","compoundAffix":"tZjZRRcAShY-","affixLabelText":"mbEcqyBQoEg-","stepperButton":"zzrCzYF-8u0-","belowField":"_0mcAZAtwQ2o-","description":"xxp2uGc-B6o-","fieldError":"q-WsOi6joGo-","spinning":"d0TEiLWObKU-"};
591
591
 
592
592
  /**
593
- * Preserve user-typed decimals on blur. Without `maximumFractionDigits: 20`,
593
+ * Default formatting used only when the consumer does not pass `format`.
594
+ * Preserves user-typed decimals on blur: without `maximumFractionDigits: 20`,
594
595
  * `Intl.NumberFormat` rounds to 3 digits and silently truncates input.
595
596
  */
596
597
  const DEFAULT_FORMAT = {
@@ -607,7 +608,7 @@ function useInputNumberExperimentalContext(consumer) {
607
608
  }
608
609
  // eslint-disable-next-line max-statements
609
610
  function InputNumberExperimentalInternal(props, ref) {
610
- const { align, autocomplete, children, description, disabled, error, id: idProp, inline, invalid, keyboard, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", suffix, value, } = props;
611
+ const { align, autocomplete, children, description, disabled, error, format, id: idProp, inline, invalid, keyboard, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", suffix, value, } = props;
611
612
  const generatedId = useId();
612
613
  const id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
613
614
  const innerInputRef = useRef(null);
@@ -682,7 +683,7 @@ function InputNumberExperimentalInternal(props, ref) {
682
683
  const fieldInvalid = invalid || Boolean(error);
683
684
  return (React__default.createElement(FieldRoot, { className: classnames(styles.container, inline && styles.inline), disabled: disabled, invalid: fieldInvalid, name: name },
684
685
  React__default.createElement(InputNumberExperimentalContext.Provider, { value: contextValue },
685
- React__default.createElement(NumberFieldRoot, { allowOutOfRange: true, format: DEFAULT_FORMAT, id: id, max: max, min: min, onValueChange: handleValueChange, onValueCommitted: handleValueCommitted, readOnly: readonly, value: value !== null && value !== void 0 ? value : null },
686
+ React__default.createElement(NumberFieldRoot, { allowOutOfRange: true, format: format !== null && format !== void 0 ? format : DEFAULT_FORMAT, id: id, max: max, min: min, onValueChange: handleValueChange, onValueCommitted: handleValueCommitted, readOnly: readonly, value: value !== null && value !== void 0 ? value : null },
686
687
  React__default.createElement(NumberFieldGroup, { className: classnames(styles.wrapper, align && styles[align], disabled && styles.disabled, size !== "default" && styles[size]) }, isUsingCompoundPattern
687
688
  ? children
688
689
  : renderDefaultComposition({ prefix, suffix, size })))),
@@ -52,6 +52,13 @@ export interface InputNumberExperimentalProps {
52
52
  readonly disabled?: boolean;
53
53
  /** When set, renders a styled error message below the field. */
54
54
  readonly error?: string;
55
+ /**
56
+ * Number formatting for the displayed value, forwarded verbatim to Base UI
57
+ * `NumberField`'s native `format`. Accepts standard `Intl.NumberFormatOptions`
58
+ * (e.g. `{ style: "currency", currency: "USD" }` or `{ maximumFractionDigits: 2 }`).
59
+ * When omitted, typed decimals are preserved without premature rounding.
60
+ */
61
+ readonly format?: Intl.NumberFormatOptions;
55
62
  readonly id?: string;
56
63
  /** Shrink-wrap the field to its content (auto width). */
57
64
  readonly inline?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "8.9.1",
3
+ "version": "8.10.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -556,5 +556,5 @@
556
556
  "> 1%",
557
557
  "IE 10"
558
558
  ],
559
- "gitHead": "2dd2b2d127e9e7e00f8db56c9a5c8ab05344e128"
559
+ "gitHead": "fff8aa8019d89e4a0d517f1eb963c8442935a16d"
560
560
  }