@jobber/components 8.16.0 → 8.18.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.
@@ -611,12 +611,14 @@ var styles = {"container":"_6HZLFIOZh4s-","inline":"_-6ndFYNKKaM-","wrapper":"c2
611
611
 
612
612
  /**
613
613
  * Default formatting used only when the consumer does not pass `format`.
614
- * Preserves user-typed decimals on blur: without `maximumFractionDigits: 20`,
615
- * `Intl.NumberFormat` rounds to 3 digits and silently truncates input.
614
+ * Base UI rounds committed values to `maximumFractionDigits`, so this cap also
615
+ * scrubs IEEE-754 step drift (keeps `3.14 + 1` from committing
616
+ * `4.140000000000001`). 12 sits below that noise floor while keeping more
617
+ * precision than a numeric field needs.
616
618
  */
617
619
  const DEFAULT_FORMAT = {
618
620
  useGrouping: false,
619
- maximumFractionDigits: 20,
621
+ maximumFractionDigits: 12,
620
622
  };
621
623
  const InputNumberExperimentalContext = React.createContext(null);
622
624
  function useInputNumberExperimentalContext(consumer) {
@@ -628,7 +630,7 @@ function useInputNumberExperimentalContext(consumer) {
628
630
  }
629
631
  // eslint-disable-next-line max-statements
630
632
  function InputNumberExperimentalInternal(props, ref) {
631
- const { align, autocomplete, children, description, disabled, error, format, id: idProp, inline, invalid, keyboard, loading, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", suffix, value, } = props;
633
+ const { align, autocomplete, children, description, disabled, error, format, id: idProp, inline, invalid, keyboard, loading, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", step = 1, suffix, value, } = props;
632
634
  const generatedId = React.useId();
633
635
  const id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
634
636
  const innerInputRef = React.useRef(null);
@@ -705,7 +707,7 @@ function InputNumberExperimentalInternal(props, ref) {
705
707
  const fieldInvalid = invalid || Boolean(error);
706
708
  return (React.createElement(FieldRoot, { className: classnames(styles.container, inline && styles.inline), disabled: disabled, invalid: fieldInvalid, name: name },
707
709
  React.createElement(InputNumberExperimentalContext.Provider, { value: contextValue },
708
- 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 },
710
+ 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, step: step, value: value !== null && value !== void 0 ? value : null },
709
711
  React.createElement(NumberFieldInput.NumberFieldGroup, { className: classnames(styles.wrapper, align && styles[align], disabled && styles.disabled, size !== "default" && styles[size]) }, isUsingCompoundPattern
710
712
  ? children
711
713
  : renderDefaultComposition({ prefix, suffix, size })))),
@@ -760,8 +762,10 @@ function InputNumberExperimentalStepperCompound({ incrementLabel, decrementLabel
760
762
  const resolvedDecrementLabel = decrementLabel !== null && decrementLabel !== void 0 ? decrementLabel : `Decrease ${labelTarget}`;
761
763
  const rootProps = useRenderElement.mergeProps({ className: styles.stepper }, { className, style });
762
764
  return (React.createElement("div", Object.assign({}, rootProps),
763
- React.createElement(NumberFieldInput.NumberFieldIncrement, { "aria-label": resolvedIncrementLabel, className: styles.stepperButton }, "\u25B2"),
764
- React.createElement(NumberFieldInput.NumberFieldDecrement, { "aria-label": resolvedDecrementLabel, className: styles.stepperButton }, "\u25BC")));
765
+ React.createElement(NumberFieldInput.NumberFieldIncrement, { "aria-label": resolvedIncrementLabel, className: styles.stepperButton },
766
+ React.createElement(Icon.Icon, { name: "arrowUp", size: "small", customColor: "currentColor" })),
767
+ React.createElement(NumberFieldInput.NumberFieldDecrement, { "aria-label": resolvedDecrementLabel, className: styles.stepperButton },
768
+ React.createElement(Icon.Icon, { name: "arrowDown", size: "small", customColor: "currentColor" }))));
765
769
  }
766
770
  function AffixIconSlot({ variation, icon, size, onClick, ariaLabel, }) {
767
771
  return (React.createElement("div", { className: classnames(styles.affixIcon, variation === "suffix" && styles.suffix) },
@@ -591,12 +591,14 @@ var styles = {"container":"_6HZLFIOZh4s-","inline":"_-6ndFYNKKaM-","wrapper":"c2
591
591
 
592
592
  /**
593
593
  * Default formatting used only when the consumer does not pass `format`.
594
- * Preserves user-typed decimals on blur: without `maximumFractionDigits: 20`,
595
- * `Intl.NumberFormat` rounds to 3 digits and silently truncates input.
594
+ * Base UI rounds committed values to `maximumFractionDigits`, so this cap also
595
+ * scrubs IEEE-754 step drift (keeps `3.14 + 1` from committing
596
+ * `4.140000000000001`). 12 sits below that noise floor while keeping more
597
+ * precision than a numeric field needs.
596
598
  */
597
599
  const DEFAULT_FORMAT = {
598
600
  useGrouping: false,
599
- maximumFractionDigits: 20,
601
+ maximumFractionDigits: 12,
600
602
  };
601
603
  const InputNumberExperimentalContext = createContext(null);
602
604
  function useInputNumberExperimentalContext(consumer) {
@@ -608,7 +610,7 @@ function useInputNumberExperimentalContext(consumer) {
608
610
  }
609
611
  // eslint-disable-next-line max-statements
610
612
  function InputNumberExperimentalInternal(props, ref) {
611
- const { align, autocomplete, children, description, disabled, error, format, id: idProp, inline, invalid, keyboard, loading, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", suffix, value, } = props;
613
+ const { align, autocomplete, children, description, disabled, error, format, id: idProp, inline, invalid, keyboard, loading, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", step = 1, suffix, value, } = props;
612
614
  const generatedId = useId();
613
615
  const id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
614
616
  const innerInputRef = useRef(null);
@@ -685,7 +687,7 @@ function InputNumberExperimentalInternal(props, ref) {
685
687
  const fieldInvalid = invalid || Boolean(error);
686
688
  return (React__default.createElement(FieldRoot, { className: classnames(styles.container, inline && styles.inline), disabled: disabled, invalid: fieldInvalid, name: name },
687
689
  React__default.createElement(InputNumberExperimentalContext.Provider, { value: contextValue },
688
- 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 },
690
+ 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, step: step, value: value !== null && value !== void 0 ? value : null },
689
691
  React__default.createElement(NumberFieldGroup, { className: classnames(styles.wrapper, align && styles[align], disabled && styles.disabled, size !== "default" && styles[size]) }, isUsingCompoundPattern
690
692
  ? children
691
693
  : renderDefaultComposition({ prefix, suffix, size })))),
@@ -740,8 +742,10 @@ function InputNumberExperimentalStepperCompound({ incrementLabel, decrementLabel
740
742
  const resolvedDecrementLabel = decrementLabel !== null && decrementLabel !== void 0 ? decrementLabel : `Decrease ${labelTarget}`;
741
743
  const rootProps = mergeProps({ className: styles.stepper }, { className, style });
742
744
  return (React__default.createElement("div", Object.assign({}, rootProps),
743
- React__default.createElement(NumberFieldIncrement, { "aria-label": resolvedIncrementLabel, className: styles.stepperButton }, "\u25B2"),
744
- React__default.createElement(NumberFieldDecrement, { "aria-label": resolvedDecrementLabel, className: styles.stepperButton }, "\u25BC")));
745
+ React__default.createElement(NumberFieldIncrement, { "aria-label": resolvedIncrementLabel, className: styles.stepperButton },
746
+ React__default.createElement(Icon, { name: "arrowUp", size: "small", customColor: "currentColor" })),
747
+ React__default.createElement(NumberFieldDecrement, { "aria-label": resolvedDecrementLabel, className: styles.stepperButton },
748
+ React__default.createElement(Icon, { name: "arrowDown", size: "small", customColor: "currentColor" }))));
745
749
  }
746
750
  function AffixIconSlot({ variation, icon, size, onClick, ariaLabel, }) {
747
751
  return (React__default.createElement("div", { className: classnames(styles.affixIcon, variation === "suffix" && styles.suffix) },
@@ -29,11 +29,6 @@ Consider the context of the countdown and whether the user will have enough
29
29
  context to interpret appropriately without labeled units when making the
30
30
  decision on whether to show or hide the units.
31
31
 
32
- ## Related components
33
-
34
- * To display a unit of time that has already passed, use
35
- [FormatRelativeDateTime](../FormatRelativeDateTime/FormatRelativeDateTime.md)
36
-
37
32
 
38
33
  ## Props
39
34
 
@@ -54,5 +54,3 @@ If using a custom activator, ensure that the activator is keyboard-operable.
54
54
  * If you are looking to use the `DatePicker` in a `Form`, consider the
55
55
  [InputDate](../InputDate/InputDate.md) component.
56
56
  * For a time input, use [InputTime](../InputTime/InputTime.md)
57
- * To represent past or future dates and times, use
58
- [FormatRelativeDateTime](../FormatRelativeDateTime/FormatRelativeDateTime.md)
@@ -40,7 +40,6 @@
40
40
  [FilterPicker](./FilterPicker/FilterPicker.md)
41
41
  [Flex](./Flex/Flex.md)
42
42
  [FormatFile](./FormatFile/FormatFile.md)
43
- [FormatRelativeDateTime](./FormatRelativeDateTime/FormatRelativeDateTime.md)
44
43
  [formatting](./formatting/formatting.md)
45
44
  [Frame](./Frame/Frame.md)
46
45
  [Gallery](./Gallery/Gallery.md)
package/dist/index.cjs CHANGED
@@ -43,7 +43,6 @@ var Flex = require('./Flex-cjs.js');
43
43
  var useAtlantisFormFieldName = require('./useAtlantisFormFieldName-cjs.js');
44
44
  var FormFieldWrapper = require('./FormFieldWrapper-cjs.js');
45
45
  var FormatFile = require('./FormatFile-cjs.js');
46
- var FormatRelativeDateTime = require('./FormatRelativeDateTime-cjs.js');
47
46
  var Frame = require('./Frame-cjs.js');
48
47
  var Gallery = require('./Gallery-cjs.js');
49
48
  var Glimmer = require('./Glimmer-cjs.js');
@@ -261,7 +260,6 @@ exports.useFormFieldWrapperStyles = FormFieldWrapper.useFormFieldWrapperStyles;
261
260
  exports.FormatFile = FormatFile.FormatFile;
262
261
  exports.useFormatFile = FormatFile.useFormatFile;
263
262
  exports.useFormatFileStyles = FormatFile.useFormatFileStyles;
264
- exports.FormatRelativeDateTime = FormatRelativeDateTime.FormatRelativeDateTime;
265
263
  exports.Frame = Frame.Frame;
266
264
  exports.Gallery = Gallery.Gallery;
267
265
  exports.GLIMMER_TEST_ID = Glimmer.GLIMMER_TEST_ID;
package/dist/index.d.mts CHANGED
@@ -32,7 +32,6 @@ export * from "./FeatureSwitch";
32
32
  export * from "./Flex";
33
33
  export * from "./FormField";
34
34
  export * from "./FormatFile";
35
- export * from "./FormatRelativeDateTime";
36
35
  export * from "./Frame";
37
36
  export * from "./Gallery";
38
37
  export * from "./Glimmer";
package/dist/index.d.ts CHANGED
@@ -32,7 +32,6 @@ export * from "./FeatureSwitch";
32
32
  export * from "./Flex";
33
33
  export * from "./FormField";
34
34
  export * from "./FormatFile";
35
- export * from "./FormatRelativeDateTime";
36
35
  export * from "./Frame";
37
36
  export * from "./Gallery";
38
37
  export * from "./Glimmer";
package/dist/index.mjs CHANGED
@@ -41,7 +41,6 @@ export { F as Flex } from './Flex-es.js';
41
41
  export { u as useAtlantisFormFieldName } from './useAtlantisFormFieldName-es.js';
42
42
  export { A as AffixIcon, f as AffixLabel, F as FormFieldInputHorizontalWrapper, a as FormFieldInputWrapperStyles, b as FormFieldLabel, c as FormFieldWrapper, d as FormFieldWrapperMain, e as FormFieldWrapperToolbar, u as useFormFieldWrapperStyles } from './FormFieldWrapper-es.js';
43
43
  export { F as FormatFile, u as useFormatFile, a as useFormatFileStyles } from './FormatFile-es.js';
44
- export { F as FormatRelativeDateTime } from './FormatRelativeDateTime-es.js';
45
44
  export { F as Frame } from './Frame-es.js';
46
45
  export { G as Gallery } from './Gallery-es.js';
47
46
  export { a as GLIMMER_TEST_ID, G as Glimmer } from './Glimmer-es.js';
@@ -111,6 +111,11 @@ export interface InputNumberExperimentalProps {
111
111
  /** Default `true`. When `false`, the floating mini-label is hidden. */
112
112
  readonly showMiniLabel?: boolean;
113
113
  readonly size?: InputNumberExperimentalSize;
114
+ /**
115
+ * Amount the stepper buttons and ArrowUp/ArrowDown keys change the value by.
116
+ * Default `1`.
117
+ */
118
+ readonly step?: number;
114
119
  readonly suffix?: InputNumberExperimentalSuffixProp;
115
120
  /**
116
121
  * Value of the field. Controlled-only — pair with `onChange` and drive from
package/dist/styles.css CHANGED
@@ -4613,8 +4613,7 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
4613
4613
  border: none;
4614
4614
  color: hsl(197, 21%, 36%);
4615
4615
  color: var(--color-text--secondary);
4616
- font-size: 8px;
4617
- line-height: 1;
4616
+ line-height: 0;
4618
4617
  background: transparent;
4619
4618
  cursor: pointer;
4620
4619
  -ms-flex-align: center;
@@ -97,7 +97,6 @@
97
97
  "FormatFile.ProgressContainer",
98
98
  "FormatFile.ThumbnailContainer",
99
99
  "FormatFile.Wrapper",
100
- "FormatRelativeDateTime",
101
100
  "Frame",
102
101
  "Gallery",
103
102
  "Glimmer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "8.16.0",
3
+ "version": "8.18.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -195,11 +195,6 @@
195
195
  "import": "./dist/FormatFile/index.mjs",
196
196
  "require": "./dist/FormatFile/index.cjs"
197
197
  },
198
- "./FormatRelativeDateTime": {
199
- "types": "./dist/FormatRelativeDateTime/index.d.ts",
200
- "import": "./dist/FormatRelativeDateTime/index.mjs",
201
- "require": "./dist/FormatRelativeDateTime/index.cjs"
202
- },
203
198
  "./Frame": {
204
199
  "types": "./dist/Frame/index.d.ts",
205
200
  "import": "./dist/Frame/index.mjs",
@@ -546,5 +541,5 @@
546
541
  "> 1%",
547
542
  "IE 10"
548
543
  ],
549
- "gitHead": "4e229c9d1f28566fb9117dd4b199efd2cbcebf9f"
544
+ "gitHead": "3239b2d272d46f01faf5f677af8c756028c3a6d8"
550
545
  }
@@ -1 +0,0 @@
1
- export * from "./dist/FormatRelativeDateTime";
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true,
5
- });
6
-
7
- var FormatRelativeDateTime = require("./dist/FormatRelativeDateTime");
8
-
9
- Object.keys(FormatRelativeDateTime).forEach(function(key) {
10
- if (key === "default" || key === "__esModule") return;
11
- Object.defineProperty(exports, key, {
12
- enumerable: true,
13
- get: function get() {
14
- return FormatRelativeDateTime[key];
15
- },
16
- });
17
- });
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- interface FormatRelativeDateTimeProps {
3
- /**
4
- * Date to be displayed.
5
- *
6
- * A `string` should be an ISO 8601 format date string.
7
- */
8
- readonly date: Date | string;
9
- }
10
- export declare function FormatRelativeDateTime({ date: inputDate, }: FormatRelativeDateTimeProps): React.JSX.Element;
11
- export {};
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- var FormatRelativeDateTime = require('../FormatRelativeDateTime-cjs.js');
4
- require('react');
5
-
6
-
7
-
8
- exports.FormatRelativeDateTime = FormatRelativeDateTime.FormatRelativeDateTime;
@@ -1 +0,0 @@
1
- export { FormatRelativeDateTime } from "./FormatRelativeDateTime";
@@ -1,2 +0,0 @@
1
- export { F as FormatRelativeDateTime } from '../FormatRelativeDateTime-es.js';
2
- import 'react';
@@ -1,63 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
-
5
- function FormatRelativeDateTime({ date: inputDate, }) {
6
- let dateObject;
7
- if (inputDate instanceof Date) {
8
- dateObject = inputDate;
9
- }
10
- else {
11
- dateObject = new Date(inputDate);
12
- }
13
- const now = Date.now() / 1000; //seconds
14
- const date = dateObject;
15
- const delta = now - date.getTime() / 1000; //seconds;
16
- switch (relativeTimeRange(delta)) {
17
- case "less than an hour":
18
- return React.createElement(React.Fragment, null, showMinutes(Math.round(delta / 60)));
19
- case "less then a day":
20
- return (React.createElement(React.Fragment, null, date.toLocaleTimeString(undefined, {
21
- hour: "numeric",
22
- minute: "numeric",
23
- })));
24
- case "less than a week":
25
- return React.createElement(React.Fragment, null, strFormatDate(date, { weekday: "short" }));
26
- case "less than a year":
27
- return React.createElement(React.Fragment, null, strFormatDate(date, { month: "short", day: "numeric" }));
28
- default:
29
- return (React.createElement(React.Fragment, null, strFormatDate(date, {
30
- month: "short",
31
- day: "numeric",
32
- year: "numeric",
33
- })));
34
- }
35
- }
36
- function relativeTimeRange(delta) {
37
- delta = delta / 60;
38
- if (delta < 60)
39
- return "less than an hour";
40
- delta = delta / 60;
41
- if (delta < 24)
42
- return "less then a day";
43
- delta = delta / 24;
44
- if (delta < 7)
45
- return "less than a week";
46
- delta = delta / 365;
47
- if (delta < 1)
48
- return "less than a year";
49
- return "a year or more";
50
- }
51
- function strFormatDate(date, options) {
52
- return date.toLocaleDateString(undefined, options);
53
- }
54
- function showMinutes(minutes) {
55
- if (minutes <= 1) {
56
- return "1 minute ago";
57
- }
58
- else {
59
- return minutes + " minutes ago";
60
- }
61
- }
62
-
63
- exports.FormatRelativeDateTime = FormatRelativeDateTime;
@@ -1,61 +0,0 @@
1
- import React__default from 'react';
2
-
3
- function FormatRelativeDateTime({ date: inputDate, }) {
4
- let dateObject;
5
- if (inputDate instanceof Date) {
6
- dateObject = inputDate;
7
- }
8
- else {
9
- dateObject = new Date(inputDate);
10
- }
11
- const now = Date.now() / 1000; //seconds
12
- const date = dateObject;
13
- const delta = now - date.getTime() / 1000; //seconds;
14
- switch (relativeTimeRange(delta)) {
15
- case "less than an hour":
16
- return React__default.createElement(React__default.Fragment, null, showMinutes(Math.round(delta / 60)));
17
- case "less then a day":
18
- return (React__default.createElement(React__default.Fragment, null, date.toLocaleTimeString(undefined, {
19
- hour: "numeric",
20
- minute: "numeric",
21
- })));
22
- case "less than a week":
23
- return React__default.createElement(React__default.Fragment, null, strFormatDate(date, { weekday: "short" }));
24
- case "less than a year":
25
- return React__default.createElement(React__default.Fragment, null, strFormatDate(date, { month: "short", day: "numeric" }));
26
- default:
27
- return (React__default.createElement(React__default.Fragment, null, strFormatDate(date, {
28
- month: "short",
29
- day: "numeric",
30
- year: "numeric",
31
- })));
32
- }
33
- }
34
- function relativeTimeRange(delta) {
35
- delta = delta / 60;
36
- if (delta < 60)
37
- return "less than an hour";
38
- delta = delta / 60;
39
- if (delta < 24)
40
- return "less then a day";
41
- delta = delta / 24;
42
- if (delta < 7)
43
- return "less than a week";
44
- delta = delta / 365;
45
- if (delta < 1)
46
- return "less than a year";
47
- return "a year or more";
48
- }
49
- function strFormatDate(date, options) {
50
- return date.toLocaleDateString(undefined, options);
51
- }
52
- function showMinutes(minutes) {
53
- if (minutes <= 1) {
54
- return "1 minute ago";
55
- }
56
- else {
57
- return minutes + " minutes ago";
58
- }
59
- }
60
-
61
- export { FormatRelativeDateTime as F };
@@ -1,30 +0,0 @@
1
- # FormatRelativeDateTime
2
-
3
- A FormatRelateDateTime displays the date and time using relative wording or
4
- approximate values. This component only represents current date and dates in the
5
- past. No future dating.
6
-
7
- ## Rules
8
-
9
- If the message was received less than an hour ago the format is x minutes ago.
10
-
11
- If the message was received today, but more than an hour ago, the format becomes
12
- the hours and minutes it was received at.
13
-
14
- If the message was received within the last six days, the format is Sun, Mon,
15
- Tue, Wed, Thu, Fri, Sat.
16
-
17
- If the message was received between six days ago and yesterday’s date one year
18
- previous, the format is Month Date.
19
-
20
- If the message was received exactly one year ago or more than one year ago, the
21
- format is Month Day, Year.
22
-
23
-
24
- ## Props
25
-
26
- ### Web
27
-
28
- | Prop | Type | Required | Default | Description |
29
- |------|------|----------|---------|-------------|
30
- | `date` | `Date | string` | Yes | — | Date to be displayed. A `string` should be an ISO 8601 format date string. |