@jobber/components 8.5.0 → 8.5.1-JOB-166462-d4f731c.8
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/LightBox/LightBox.d.ts +23 -2
- package/dist/LightBox/LightBox.types.d.ts +41 -0
- package/dist/LightBox-cjs.js +35 -5
- package/dist/LightBox-es.js +35 -5
- 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/LightBox/LightBox.md +54 -0
- package/dist/docs/usage-guidelines/usage-guidelines.md +6 -35
- package/dist/sharedHelpers/types.d.ts +0 -4
- package/dist/utils/meta/meta.json +4 -1
- 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
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { LightBoxNavigationProps, LightBoxProps } from "./LightBox.types";
|
|
2
|
+
import type { LightBoxNavigationProps, LightBoxProps, LightBoxThumbnailBarProps, LightBoxThumbnailImageProps, LightBoxThumbnailProps } from "./LightBox.types";
|
|
3
3
|
import { LightBoxProvider } from "./LightBoxContext";
|
|
4
4
|
export declare function LightBoxContent(): React.JSX.Element;
|
|
5
5
|
/**
|
|
@@ -75,7 +75,25 @@ declare function LightBoxCaption(): React.JSX.Element | null;
|
|
|
75
75
|
/**
|
|
76
76
|
* Scrollable thumbnail strip. Only renders when there are two or more images.
|
|
77
77
|
*/
|
|
78
|
-
declare function LightBoxThumbnails(): React.JSX.Element
|
|
78
|
+
declare function LightBoxThumbnails(): React.JSX.Element;
|
|
79
|
+
/**
|
|
80
|
+
* Scrollable container for the thumbnail strip. Owns the scroll chrome and
|
|
81
|
+
* box-sizing, and only renders when there are two or more images.
|
|
82
|
+
*
|
|
83
|
+
* Pass one `LightBox.Thumbnail` per image as `children` to own the thumbnail
|
|
84
|
+
* loop.
|
|
85
|
+
*/
|
|
86
|
+
declare function LightBoxThumbnailBar({ children, className, }: LightBoxThumbnailBarProps): React.JSX.Element | null;
|
|
87
|
+
/**
|
|
88
|
+
* A selectable thumbnail cell identified by its `index`. Owns the selected
|
|
89
|
+
* styling, click-to-navigate behaviour, and renders consumer-provided
|
|
90
|
+
* `children` (typically a `LightBox.ThumbnailImage`).
|
|
91
|
+
*/
|
|
92
|
+
declare function LightBoxThumbnail({ index, children, className, }: LightBoxThumbnailProps): React.JSX.Element;
|
|
93
|
+
/**
|
|
94
|
+
* A thumbnail using our default styling.
|
|
95
|
+
*/
|
|
96
|
+
declare function LightBoxThumbnailImage({ src, alt, className, }: LightBoxThumbnailImageProps): React.JSX.Element;
|
|
79
97
|
/**
|
|
80
98
|
* LightBox displays images in a fullscreen overlay.
|
|
81
99
|
*
|
|
@@ -128,5 +146,8 @@ declare namespace LightBox {
|
|
|
128
146
|
var Navigation: typeof LightBoxNavigation;
|
|
129
147
|
var Caption: typeof LightBoxCaption;
|
|
130
148
|
var Thumbnails: typeof LightBoxThumbnails;
|
|
149
|
+
var ThumbnailBar: typeof LightBoxThumbnailBar;
|
|
150
|
+
var Thumbnail: typeof LightBoxThumbnail;
|
|
151
|
+
var ThumbnailImage: typeof LightBoxThumbnailImage;
|
|
131
152
|
}
|
|
132
153
|
export { LightBox };
|
|
@@ -92,3 +92,44 @@ export interface LightBoxNavigationProps {
|
|
|
92
92
|
*/
|
|
93
93
|
readonly nextButtonClassName?: string;
|
|
94
94
|
}
|
|
95
|
+
export interface LightBoxThumbnailBarProps {
|
|
96
|
+
/**
|
|
97
|
+
* The thumbnails to render inside the scrollable bar, typically one
|
|
98
|
+
* `LightBox.Thumbnail` per image.
|
|
99
|
+
*/
|
|
100
|
+
readonly children: ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* Additional class name to apply to the thumbnail bar wrapper.
|
|
103
|
+
*/
|
|
104
|
+
readonly className?: string;
|
|
105
|
+
}
|
|
106
|
+
export interface LightBoxThumbnailProps {
|
|
107
|
+
/**
|
|
108
|
+
* The index of the image this thumbnail represents. Used to derive the
|
|
109
|
+
* selected state and to navigate to the image when activated.
|
|
110
|
+
*/
|
|
111
|
+
readonly index: number;
|
|
112
|
+
/**
|
|
113
|
+
* The content rendered inside the selectable thumbnail cell, typically a
|
|
114
|
+
* `LightBox.ThumbnailImage`.
|
|
115
|
+
*/
|
|
116
|
+
readonly children: ReactNode;
|
|
117
|
+
/**
|
|
118
|
+
* Additional class name to apply to the thumbnail cell.
|
|
119
|
+
*/
|
|
120
|
+
readonly className?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface LightBoxThumbnailImageProps {
|
|
123
|
+
/**
|
|
124
|
+
* The image source to render.
|
|
125
|
+
*/
|
|
126
|
+
readonly src: string;
|
|
127
|
+
/**
|
|
128
|
+
* The alternative text for the image.
|
|
129
|
+
*/
|
|
130
|
+
readonly alt: string;
|
|
131
|
+
/**
|
|
132
|
+
* Additional class name to apply to the image.
|
|
133
|
+
*/
|
|
134
|
+
readonly className?: string;
|
|
135
|
+
}
|
package/dist/LightBox-cjs.js
CHANGED
|
@@ -305,13 +305,40 @@ function LightBoxCaption() {
|
|
|
305
305
|
* Scrollable thumbnail strip. Only renders when there are two or more images.
|
|
306
306
|
*/
|
|
307
307
|
function LightBoxThumbnails() {
|
|
308
|
-
const { images
|
|
308
|
+
const { images } = useLightBoxContext();
|
|
309
|
+
return (React.createElement(LightBoxThumbnailBar, null, images.map((image, index) => (React.createElement(LightBoxThumbnail, { key: index, index: index },
|
|
310
|
+
React.createElement(LightBoxThumbnailImage, { src: image.url, alt: image.alt || image.title || "" }))))));
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Scrollable container for the thumbnail strip. Owns the scroll chrome and
|
|
314
|
+
* box-sizing, and only renders when there are two or more images.
|
|
315
|
+
*
|
|
316
|
+
* Pass one `LightBox.Thumbnail` per image as `children` to own the thumbnail
|
|
317
|
+
* loop.
|
|
318
|
+
*/
|
|
319
|
+
function LightBoxThumbnailBar({ children, className, }) {
|
|
320
|
+
const { images, boxSizing } = useLightBoxContext();
|
|
309
321
|
if (images.length <= 1)
|
|
310
322
|
return null;
|
|
311
|
-
return (React.createElement("div", { className: styles.thumbnailBar, style: { "--lightbox--box-sizing": boxSizing }, "data-testid": "ATL-Thumbnail-Bar" },
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
323
|
+
return (React.createElement("div", { className: classnames(styles.thumbnailBar, className), style: { "--lightbox--box-sizing": boxSizing }, "data-testid": "ATL-Thumbnail-Bar" }, children));
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* A selectable thumbnail cell identified by its `index`. Owns the selected
|
|
327
|
+
* styling, click-to-navigate behaviour, and renders consumer-provided
|
|
328
|
+
* `children` (typically a `LightBox.ThumbnailImage`).
|
|
329
|
+
*/
|
|
330
|
+
function LightBoxThumbnail({ index, children, className, }) {
|
|
331
|
+
const { currentImageIndex, selectedThumbnailRef, handleThumbnailClick } = useLightBoxContext();
|
|
332
|
+
const selected = index === currentImageIndex;
|
|
333
|
+
return (React.createElement("div", { className: classnames(styles.thumbnail, className, {
|
|
334
|
+
[styles.selected]: selected,
|
|
335
|
+
}), onClick: () => handleThumbnailClick(index), ref: selected ? selectedThumbnailRef : null }, children));
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* A thumbnail using our default styling.
|
|
339
|
+
*/
|
|
340
|
+
function LightBoxThumbnailImage({ src, alt, className, }) {
|
|
341
|
+
return (React.createElement("img", { src: src, alt: alt, className: classnames(styles.thumbnailImage, className) }));
|
|
315
342
|
}
|
|
316
343
|
/**
|
|
317
344
|
* LightBox displays images in a fullscreen overlay.
|
|
@@ -367,6 +394,9 @@ LightBox.Slides = LightBoxSlides;
|
|
|
367
394
|
LightBox.Navigation = LightBoxNavigation;
|
|
368
395
|
LightBox.Caption = LightBoxCaption;
|
|
369
396
|
LightBox.Thumbnails = LightBoxThumbnails;
|
|
397
|
+
LightBox.ThumbnailBar = LightBoxThumbnailBar;
|
|
398
|
+
LightBox.Thumbnail = LightBoxThumbnail;
|
|
399
|
+
LightBox.ThumbnailImage = LightBoxThumbnailImage;
|
|
370
400
|
|
|
371
401
|
exports.LightBox = LightBox;
|
|
372
402
|
exports.useLightBoxContext = useLightBoxContext;
|
package/dist/LightBox-es.js
CHANGED
|
@@ -303,13 +303,40 @@ function LightBoxCaption() {
|
|
|
303
303
|
* Scrollable thumbnail strip. Only renders when there are two or more images.
|
|
304
304
|
*/
|
|
305
305
|
function LightBoxThumbnails() {
|
|
306
|
-
const { images
|
|
306
|
+
const { images } = useLightBoxContext();
|
|
307
|
+
return (React__default.createElement(LightBoxThumbnailBar, null, images.map((image, index) => (React__default.createElement(LightBoxThumbnail, { key: index, index: index },
|
|
308
|
+
React__default.createElement(LightBoxThumbnailImage, { src: image.url, alt: image.alt || image.title || "" }))))));
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Scrollable container for the thumbnail strip. Owns the scroll chrome and
|
|
312
|
+
* box-sizing, and only renders when there are two or more images.
|
|
313
|
+
*
|
|
314
|
+
* Pass one `LightBox.Thumbnail` per image as `children` to own the thumbnail
|
|
315
|
+
* loop.
|
|
316
|
+
*/
|
|
317
|
+
function LightBoxThumbnailBar({ children, className, }) {
|
|
318
|
+
const { images, boxSizing } = useLightBoxContext();
|
|
307
319
|
if (images.length <= 1)
|
|
308
320
|
return null;
|
|
309
|
-
return (React__default.createElement("div", { className: styles.thumbnailBar, style: { "--lightbox--box-sizing": boxSizing }, "data-testid": "ATL-Thumbnail-Bar" },
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
321
|
+
return (React__default.createElement("div", { className: classnames(styles.thumbnailBar, className), style: { "--lightbox--box-sizing": boxSizing }, "data-testid": "ATL-Thumbnail-Bar" }, children));
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* A selectable thumbnail cell identified by its `index`. Owns the selected
|
|
325
|
+
* styling, click-to-navigate behaviour, and renders consumer-provided
|
|
326
|
+
* `children` (typically a `LightBox.ThumbnailImage`).
|
|
327
|
+
*/
|
|
328
|
+
function LightBoxThumbnail({ index, children, className, }) {
|
|
329
|
+
const { currentImageIndex, selectedThumbnailRef, handleThumbnailClick } = useLightBoxContext();
|
|
330
|
+
const selected = index === currentImageIndex;
|
|
331
|
+
return (React__default.createElement("div", { className: classnames(styles.thumbnail, className, {
|
|
332
|
+
[styles.selected]: selected,
|
|
333
|
+
}), onClick: () => handleThumbnailClick(index), ref: selected ? selectedThumbnailRef : null }, children));
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* A thumbnail using our default styling.
|
|
337
|
+
*/
|
|
338
|
+
function LightBoxThumbnailImage({ src, alt, className, }) {
|
|
339
|
+
return (React__default.createElement("img", { src: src, alt: alt, className: classnames(styles.thumbnailImage, className) }));
|
|
313
340
|
}
|
|
314
341
|
/**
|
|
315
342
|
* LightBox displays images in a fullscreen overlay.
|
|
@@ -365,5 +392,8 @@ LightBox.Slides = LightBoxSlides;
|
|
|
365
392
|
LightBox.Navigation = LightBoxNavigation;
|
|
366
393
|
LightBox.Caption = LightBoxCaption;
|
|
367
394
|
LightBox.Thumbnails = LightBoxThumbnails;
|
|
395
|
+
LightBox.ThumbnailBar = LightBoxThumbnailBar;
|
|
396
|
+
LightBox.Thumbnail = LightBoxThumbnail;
|
|
397
|
+
LightBox.ThumbnailImage = LightBoxThumbnailImage;
|
|
368
398
|
|
|
369
399
|
export { LightBox as L, useLightBoxContext as u };
|
|
@@ -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... |
|
|
@@ -43,6 +43,10 @@ LightBox exposes its internal building blocks as subcomponents:
|
|
|
43
43
|
`LightBox.Navigation`, `LightBox.Caption`, and `LightBox.Thumbnails`. This gives
|
|
44
44
|
you more control over the LightBox's appearance and behaviour.
|
|
45
45
|
|
|
46
|
+
The thumbnail strip is itself composed of smaller subcomponents you can use
|
|
47
|
+
directly: `LightBox.ThumbnailBar`, `LightBox.Thumbnail`, and
|
|
48
|
+
`LightBox.ThumbnailImage`. See [Custom thumbnails](#custom-thumbnails) below.
|
|
49
|
+
|
|
46
50
|
Here's a basic example of how the non-composable LightBox is used:
|
|
47
51
|
|
|
48
52
|
```tsx
|
|
@@ -157,6 +161,33 @@ function CustomControls() {
|
|
|
157
161
|
}
|
|
158
162
|
```
|
|
159
163
|
|
|
164
|
+
### Custom thumbnails
|
|
165
|
+
|
|
166
|
+
`LightBox.Thumbnails` renders the default thumbnail strip and requires no
|
|
167
|
+
configuration. When you need to control how each thumbnail renders, compose the
|
|
168
|
+
thumbnail subcomponents yourself:
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
import { LightBox, useLightBoxContext } from "@jobber/components";
|
|
172
|
+
|
|
173
|
+
function CustomThumbnails() {
|
|
174
|
+
const { images } = useLightBoxContext();
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<LightBox.ThumbnailBar>
|
|
178
|
+
{images.map((image, index) => (
|
|
179
|
+
<LightBox.Thumbnail key={index} index={index}>
|
|
180
|
+
<LightBox.ThumbnailImage
|
|
181
|
+
src={image.url}
|
|
182
|
+
alt={image.alt ?? image.title ?? ""}
|
|
183
|
+
/>
|
|
184
|
+
</LightBox.Thumbnail>
|
|
185
|
+
))}
|
|
186
|
+
</LightBox.ThumbnailBar>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
160
191
|
## Testing
|
|
161
192
|
|
|
162
193
|
When using Jest to test LightBox implementations, you will need to include this
|
|
@@ -223,3 +254,26 @@ window.HTMLElement.prototype.scrollIntoView = scrollIntoViewMock;
|
|
|
223
254
|
| Prop | Type | Required | Default | Description |
|
|
224
255
|
|------|------|----------|---------|-------------|
|
|
225
256
|
| `className` | `string` | No | — | |
|
|
257
|
+
|
|
258
|
+
#### LightBox.Thumbnail
|
|
259
|
+
|
|
260
|
+
| Prop | Type | Required | Default | Description |
|
|
261
|
+
|------|------|----------|---------|-------------|
|
|
262
|
+
| `children` | `ReactNode` | Yes | — | The content rendered inside the selectable thumbnail cell, typically a `LightBox.ThumbnailImage`. |
|
|
263
|
+
| `index` | `number` | Yes | — | The index of the image this thumbnail represents. Used to derive the selected state and to navigate to the image when... |
|
|
264
|
+
| `className` | `string` | No | — | Additional class name to apply to the thumbnail cell. |
|
|
265
|
+
|
|
266
|
+
#### LightBox.ThumbnailBar
|
|
267
|
+
|
|
268
|
+
| Prop | Type | Required | Default | Description |
|
|
269
|
+
|------|------|----------|---------|-------------|
|
|
270
|
+
| `children` | `ReactNode` | Yes | — | The thumbnails to render inside the scrollable bar, typically one `LightBox.Thumbnail` per image. |
|
|
271
|
+
| `className` | `string` | No | — | Additional class name to apply to the thumbnail bar wrapper. |
|
|
272
|
+
|
|
273
|
+
#### LightBox.ThumbnailImage
|
|
274
|
+
|
|
275
|
+
| Prop | Type | Required | Default | Description |
|
|
276
|
+
|------|------|----------|---------|-------------|
|
|
277
|
+
| `alt` | `string` | Yes | — | The alternative text for the image. |
|
|
278
|
+
| `src` | `string` | Yes | — | The image source to render. |
|
|
279
|
+
| `className` | `string` | No | — | Additional class name to apply to the image. |
|
|
@@ -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;
|
|
@@ -141,6 +141,9 @@
|
|
|
141
141
|
"LightBox.Overlay",
|
|
142
142
|
"LightBox.Provider",
|
|
143
143
|
"LightBox.Slides",
|
|
144
|
+
"LightBox.Thumbnail",
|
|
145
|
+
"LightBox.ThumbnailBar",
|
|
146
|
+
"LightBox.ThumbnailImage",
|
|
144
147
|
"LightBox.Thumbnails",
|
|
145
148
|
"LightBox.Toolbar",
|
|
146
149
|
"Link",
|
|
@@ -229,4 +232,4 @@
|
|
|
229
232
|
"Tooltip",
|
|
230
233
|
"Typography"
|
|
231
234
|
]
|
|
232
|
-
}
|
|
235
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.1-JOB-166462-d4f731c.8+d4f731c4",
|
|
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": "d4f731c4c9f9e661c9a852e129bf4eec14935810"
|
|
572
572
|
}
|