@jobber/components 8.5.0 → 8.6.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/FormField/FormFieldTypes.d.ts +0 -7
- package/dist/InputDate/InputDate.types.d.ts +1 -1
- package/dist/InputEmail/InputEmail.types.d.ts +1 -1
- package/dist/InputNumber/InputNumber.types.d.ts +1 -1
- package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +1 -1
- package/dist/InputText/InputText.types.d.ts +1 -5
- package/dist/InputTime/InputTime.types.d.ts +1 -1
- package/dist/Select/OptionGroup.d.ts +2 -2
- package/dist/Select/Select.types.d.ts +1 -1
- package/dist/docs/FormField/FormField.md +0 -1
- package/dist/docs/InputPassword/InputPassword.md +0 -1
- package/dist/docs/usage-guidelines/usage-guidelines.md +6 -35
- package/dist/sharedHelpers/types.d.ts +0 -4
- package/package.json +2 -2
|
@@ -100,13 +100,6 @@ export interface CommonFormFieldProps {
|
|
|
100
100
|
* set it to `always`.
|
|
101
101
|
*/
|
|
102
102
|
readonly clearable?: Clearable;
|
|
103
|
-
/**
|
|
104
|
-
* Experimental:
|
|
105
|
-
* Determine which version of the FormField to use.
|
|
106
|
-
* Right now this isn't used but it will be used in the future
|
|
107
|
-
* to allow us to release new versions of our form inputs without breaking existing functionality.
|
|
108
|
-
*/
|
|
109
|
-
version?: 1;
|
|
110
103
|
}
|
|
111
104
|
export interface FormFieldProps extends CommonFormFieldProps {
|
|
112
105
|
actionsRef?: RefObject<FieldActionsRef | null>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FormFieldProps } from "../FormField";
|
|
2
2
|
import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
3
|
-
export interface InputDateProps extends Omit<HTMLInputBaseProps, "maxLength">, FocusEvents<HTMLInputElement | HTMLTextAreaElement>, KeyboardEvents<HTMLInputElement | HTMLTextAreaElement>, Omit<RebuiltInputCommonProps, "clearable" | "prefix" | "suffix" | "showMiniLabel"
|
|
3
|
+
export interface InputDateProps extends Omit<HTMLInputBaseProps, "maxLength">, FocusEvents<HTMLInputElement | HTMLTextAreaElement>, KeyboardEvents<HTMLInputElement | HTMLTextAreaElement>, Omit<RebuiltInputCommonProps, "clearable" | "prefix" | "suffix" | "showMiniLabel"> {
|
|
4
4
|
/**
|
|
5
5
|
* A Date object value
|
|
6
6
|
* (e.g., `new Date("11/11/2011")`)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FormFieldProps } from "../FormField";
|
|
2
2
|
import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, MouseEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
3
|
-
export interface InputEmailProps extends HTMLInputBaseProps, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, MouseEvents<HTMLInputElement>, Omit<RebuiltInputCommonProps, "showMiniLabel"
|
|
3
|
+
export interface InputEmailProps extends HTMLInputBaseProps, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, MouseEvents<HTMLInputElement>, Omit<RebuiltInputCommonProps, "showMiniLabel"> {
|
|
4
4
|
/**
|
|
5
5
|
* The current value of the input.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
2
|
import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, MouseEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
3
|
-
export interface InputNumberProps extends HTMLInputBaseProps, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, MouseEvents<HTMLInputElement>, Omit<RebuiltInputCommonProps, "clearable" | "suffix" | "prefix"
|
|
3
|
+
export interface InputNumberProps extends HTMLInputBaseProps, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, MouseEvents<HTMLInputElement>, Omit<RebuiltInputCommonProps, "clearable" | "suffix" | "prefix"> {
|
|
4
4
|
readonly defaultValue?: number;
|
|
5
5
|
readonly formatOptions?: Intl.NumberFormatOptions;
|
|
6
6
|
readonly maxValue?: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { InputMaskProps } from "./InputMask";
|
|
2
2
|
import type { FormFieldProps } from "../FormField";
|
|
3
3
|
import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, MouseEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
4
|
-
export interface InputPhoneNumberProps extends Omit<HTMLInputBaseProps, "type" | "maxLength" | "minLength">, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, MouseEvents<HTMLInputElement>, Omit<RebuiltInputCommonProps, "showMiniLabel"
|
|
4
|
+
export interface InputPhoneNumberProps extends Omit<HTMLInputBaseProps, "type" | "maxLength" | "minLength">, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, MouseEvents<HTMLInputElement>, Omit<RebuiltInputCommonProps, "showMiniLabel"> {
|
|
5
5
|
/**
|
|
6
6
|
* The current value of the input.
|
|
7
7
|
*/
|
|
@@ -15,11 +15,7 @@ interface InputLengthConstraint {
|
|
|
15
15
|
*/
|
|
16
16
|
readonly maxLength?: number;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
* Experimental version 2 of the InputText component.
|
|
20
|
-
* Do not use unless you have talked with Atlantis first.
|
|
21
|
-
*/
|
|
22
|
-
export interface InputTextProps extends HTMLInputBaseProps, MouseEvents<HTMLInputElement | HTMLTextAreaElement>, FocusEvents<HTMLInputElement | HTMLTextAreaElement>, KeyboardEvents<HTMLInputElement | HTMLTextAreaElement>, Omit<RebuiltInputCommonProps, "version">, InputLengthConstraint {
|
|
18
|
+
export interface InputTextProps extends HTMLInputBaseProps, MouseEvents<HTMLInputElement | HTMLTextAreaElement>, FocusEvents<HTMLInputElement | HTMLTextAreaElement>, KeyboardEvents<HTMLInputElement | HTMLTextAreaElement>, RebuiltInputCommonProps, InputLengthConstraint {
|
|
23
19
|
/**
|
|
24
20
|
* When false, the placeholder text only serves as a standard placeholder and
|
|
25
21
|
* disappears when the user types, instead of floating above the value as a
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Ref } from "react";
|
|
2
2
|
import type { FormFieldProps } from "../FormField";
|
|
3
3
|
import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, MouseEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
4
|
-
export interface InputTimeProps extends Omit<HTMLInputBaseProps, "maxLength">, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, MouseEvents<HTMLInputElement>, Omit<RebuiltInputCommonProps, "showMiniLabel"
|
|
4
|
+
export interface InputTimeProps extends Omit<HTMLInputBaseProps, "maxLength">, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, MouseEvents<HTMLInputElement>, Omit<RebuiltInputCommonProps, "showMiniLabel">, Pick<InputTimeProps, "value" | "onChange"> {
|
|
5
5
|
/**
|
|
6
6
|
* Maximum numerical or date value.
|
|
7
7
|
*/
|
|
@@ -10,7 +10,7 @@ export interface OptionGroupProps {
|
|
|
10
10
|
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
11
11
|
*
|
|
12
12
|
* Additional details: The provided class names are applied to the root `<optgroup>` element.
|
|
13
|
-
* Only effective when `Select`
|
|
13
|
+
* Only effective when `Select` is used with `UNSAFE_experimentalStyles`.
|
|
14
14
|
*/
|
|
15
15
|
readonly UNSAFE_className?: string;
|
|
16
16
|
/**
|
|
@@ -19,7 +19,7 @@ export interface OptionGroupProps {
|
|
|
19
19
|
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
20
20
|
*
|
|
21
21
|
* Additional details: Styles are applied directly to the root `<optgroup>` element via
|
|
22
|
-
* `UNSAFE_style.container`. Only effective when `Select`
|
|
22
|
+
* `UNSAFE_style.container`. Only effective when `Select` is used with
|
|
23
23
|
* `UNSAFE_experimentalStyles`.
|
|
24
24
|
*/
|
|
25
25
|
readonly UNSAFE_style?: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Ref } from "react";
|
|
2
2
|
import type { FormFieldProps } from "../FormField";
|
|
3
3
|
import type { FocusEvents, HTMLInputBaseProps, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
4
|
-
export interface SelectProps extends Omit<HTMLInputBaseProps, "readOnly" | "maxLength">, FocusEvents<HTMLSelectElement>, Omit<RebuiltInputCommonProps, "clearable" | "prefix" | "suffix" | "align" | "showMiniLabel"
|
|
4
|
+
export interface SelectProps extends Omit<HTMLInputBaseProps, "readOnly" | "maxLength">, FocusEvents<HTMLSelectElement>, Omit<RebuiltInputCommonProps, "clearable" | "prefix" | "suffix" | "align" | "showMiniLabel">, Pick<FormFieldProps, "prefix" | "suffix" | "align" | "children"> {
|
|
5
5
|
readonly value?: string | number;
|
|
6
6
|
onChange?(newValue?: string | number): void;
|
|
7
7
|
readonly inputRef?: Ref<HTMLSelectElement>;
|
|
@@ -89,5 +89,4 @@ export function SpecialInput(props) {
|
|
|
89
89
|
| `type` | `FormFieldTypes` | No | — | Determines what kind of form field should the component give you. |
|
|
90
90
|
| `validations` | `RegisterOptions` | No | — | Show an error message above the field. This also highlights the the field red if an error message shows up. |
|
|
91
91
|
| `value` | `Date | number | string` | No | — | Set the component to the given value. |
|
|
92
|
-
| `version` | `1` | No | — | Experimental: Determine which version of the FormField to use. Right now this isn't used but it will be used in the f... |
|
|
93
92
|
| `wrapperRef` | `RefObject<HTMLDivElement>` | No | — | |
|
|
@@ -49,4 +49,3 @@ refer to [InputText](../InputText/InputText.md).
|
|
|
49
49
|
| `size` | `"large" | "small"` | No | — | Adjusts the interface to either have small or large spacing. |
|
|
50
50
|
| `validations` | `RegisterOptions` | No | — | Show an error message above the field. This also highlights the the field red if an error message shows up. |
|
|
51
51
|
| `value` | `string` | No | — | Set the component to the given value. |
|
|
52
|
-
| `version` | `1` | No | — | Experimental: Determine which version of the FormField to use. Right now this isn't used but it will be used in the f... |
|
|
@@ -24,13 +24,12 @@ deprecated.
|
|
|
24
24
|
|
|
25
25
|
### Deprecated props on still-supported components
|
|
26
26
|
|
|
27
|
-
| Component
|
|
28
|
-
|
|
|
29
|
-
| `Button`
|
|
30
|
-
| `Card`
|
|
31
|
-
| `Toast`
|
|
32
|
-
| Text inputs (`InputText`
|
|
33
|
-
| `FormField` (`maxLength` on v1 inputs) | `maxLength` | Flagged in source as flawed; only kept for v1 backwards compatibility. |
|
|
27
|
+
| Component | Deprecated prop | Replacement |
|
|
28
|
+
| ------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------- |
|
|
29
|
+
| `Button` | `to` | Use `url` for anchor links. |
|
|
30
|
+
| `Card` | `title` | Use the `header` prop, or compose with `Card.Header` and `Card.Body`. |
|
|
31
|
+
| `Toast` | `action`, `actionLabel` | Both will be removed in the next major version. Trigger follow-up work from outside the toast. |
|
|
32
|
+
| Text inputs (`InputText`) | `onEnter` | Use `onKeyDown` or `onKeyUp` and check the key. |
|
|
34
33
|
|
|
35
34
|
## Import pattern
|
|
36
35
|
|
|
@@ -67,34 +66,6 @@ custom properties from `@jobber/design`. Tokens are included in:
|
|
|
67
66
|
}
|
|
68
67
|
```
|
|
69
68
|
|
|
70
|
-
## Form composition
|
|
71
|
-
|
|
72
|
-
v2 inputs are thin wrappers over native HTML inputs. They have no internal form
|
|
73
|
-
state, no built-in validation orchestration, and no React Hook Form dependency —
|
|
74
|
-
they behave like `<input>` elements with Atlantis styling. Compose them inside a
|
|
75
|
-
plain `<form>` and manage state and submission yourself (or with the form
|
|
76
|
-
library of your choice).
|
|
77
|
-
|
|
78
|
-
```tsx
|
|
79
|
-
<form onSubmit={handleSubmit}>
|
|
80
|
-
<Content>
|
|
81
|
-
<InputText version={2} name="name" placeholder="Name" />
|
|
82
|
-
<InputEmail version={2} name="email" placeholder="Email" />
|
|
83
|
-
<Button type="submit" label="Save" />
|
|
84
|
-
</Content>
|
|
85
|
-
</form>
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Do not wrap v2 inputs in the Atlantis `Form` or `FormField` components — those
|
|
89
|
-
are legacy helpers tied to v1 inputs and React Hook Form. Mixing them with v2
|
|
90
|
-
inputs will not give you v2's controlled API and is not supported.
|
|
91
|
-
|
|
92
|
-
### Validation on v2 inputs
|
|
93
|
-
|
|
94
|
-
v2 inputs do not run validation themselves. To show an error state, drive it
|
|
95
|
-
from your own state and pass `invalid` (boolean) and/or `error` (string message)
|
|
96
|
-
on the input.
|
|
97
|
-
|
|
98
69
|
## Compound components — use the documented composition
|
|
99
70
|
|
|
100
71
|
Many components expose dot-notation subcomponents that must be used together.
|
|
@@ -243,10 +243,6 @@ export interface RebuiltInputCommonProps {
|
|
|
243
243
|
* Further description of the input, can be used for a hint.
|
|
244
244
|
*/
|
|
245
245
|
readonly description?: ReactNode;
|
|
246
|
-
/**
|
|
247
|
-
* Version 2 is highly experimental. Avoid using it unless you have talked with Atlantis first.
|
|
248
|
-
*/
|
|
249
|
-
readonly version: 2;
|
|
250
246
|
}
|
|
251
247
|
/** Represents a day of the week as a number where 0 = Sunday, 1 = Monday, etc. */
|
|
252
248
|
export type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -568,5 +568,5 @@
|
|
|
568
568
|
"> 1%",
|
|
569
569
|
"IE 10"
|
|
570
570
|
],
|
|
571
|
-
"gitHead": "
|
|
571
|
+
"gitHead": "3f1dd8cc5b57561326b2dad6431310db346554a5"
|
|
572
572
|
}
|