@jobber/components 6.71.3 → 6.73.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/Banner/Banner.d.ts +9 -31
- package/dist/Banner/Banner.types.d.ts +164 -0
- package/dist/Banner/BannerContext.d.ts +18 -0
- package/dist/Banner/index.cjs +4 -5
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.mjs +4 -5
- package/dist/Banner-cjs.js +94 -40
- package/dist/Banner-es.js +94 -40
- package/dist/Checkbox/Checkbox.rebuilt.d.ts +1 -1
- package/dist/Checkbox/Checkbox.types.d.ts +3 -3
- package/dist/FormField/FormFieldDescription.d.ts +2 -2
- package/dist/FormField/FormFieldTypes.d.ts +1 -1
- package/dist/FormField-cjs.js +2 -2
- package/dist/FormField-es.js +2 -2
- package/dist/InputEmail/hooks/useInputEmailFormField.d.ts +2 -2
- package/dist/InputNumber/InputNumber.rebuilt.types.d.ts +2 -2
- package/dist/InputPhoneNumber/hooks/useInputPhoneFormField.d.ts +2 -2
- package/dist/InputText/InputText.d.ts +2 -2
- package/dist/InputText/useInputTextFormField.d.ts +3 -3
- package/dist/Select/hooks/useSelectFormField.d.ts +2 -2
- package/dist/index.cjs +0 -1
- package/dist/index.mjs +0 -1
- package/dist/styles.css +4 -4
- package/dist/utils/meta/meta.json +5 -0
- package/package.json +2 -2
- package/dist/Banner/components/BannerIcon/BannerIcon.d.ts +0 -8
- package/dist/Banner/components/BannerIcon/index.cjs +0 -11
- package/dist/Banner/components/BannerIcon/index.d.ts +0 -1
- package/dist/Banner/components/BannerIcon/index.mjs +0 -5
- package/dist/BannerIcon-cjs.js +0 -17
- package/dist/BannerIcon-es.js +0 -14
package/dist/Banner/Banner.d.ts
CHANGED
|
@@ -1,32 +1,10 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
readonly type: BannerType;
|
|
11
|
-
/**
|
|
12
|
-
* Accepts props for Button. Default action uses a 'subtle' Button
|
|
13
|
-
*/
|
|
14
|
-
readonly primaryAction?: ButtonProps;
|
|
15
|
-
/**
|
|
16
|
-
* Set to false to hide the dismiss button
|
|
17
|
-
* @default true
|
|
18
|
-
*/
|
|
19
|
-
readonly dismissible?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Use to override the default status Icon
|
|
22
|
-
*/
|
|
23
|
-
readonly icon?: IconNames;
|
|
24
|
-
onDismiss?(): void;
|
|
25
|
-
/**
|
|
26
|
-
* When provided, Banner's visibility is controlled by this value
|
|
27
|
-
* @default undefined
|
|
28
|
-
*/
|
|
29
|
-
readonly controlledVisiblity?: boolean;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BannerActionProps, BannerContentProps, BannerDismissButtonProps, BannerIconProps, BannerProps, BannerProviderProps } from "./Banner.types";
|
|
3
|
+
export declare function Banner({ children, type, primaryAction, dismissible, icon, onDismiss, controlledVisiblity, }: BannerProps): React.JSX.Element;
|
|
4
|
+
export declare namespace Banner {
|
|
5
|
+
var Provider: ({ children, visible, type, onDismiss, icon, dismissButton, UNSAFE_className, UNSAFE_style, }: BannerProviderProps) => React.JSX.Element;
|
|
6
|
+
var Icon: ({ backgroundColor, UNSAFE_className, UNSAFE_style, ...iconProps }: BannerIconProps) => React.JSX.Element | null;
|
|
7
|
+
var Content: (props: BannerContentProps) => React.JSX.Element;
|
|
8
|
+
var DismissButton: (props: BannerDismissButtonProps) => React.JSX.Element;
|
|
9
|
+
var Action: ({ UNSAFE_className, UNSAFE_style, ...buttonProps }: BannerActionProps) => React.JSX.Element;
|
|
30
10
|
}
|
|
31
|
-
export declare function Banner({ children, type, primaryAction, dismissible, icon, onDismiss, controlledVisiblity, }: BannerProps): React.JSX.Element | null;
|
|
32
|
-
export {};
|
|
@@ -1 +1,165 @@
|
|
|
1
|
+
import { type CSSProperties, type PropsWithChildren, type ReactNode } from "react";
|
|
2
|
+
import { type IconNames, tokens } from "@jobber/design";
|
|
3
|
+
import { type ButtonProps } from "../Button";
|
|
4
|
+
import { type ButtonDismissProps } from "../ButtonDismiss";
|
|
5
|
+
import { IconProps } from "../Icon";
|
|
1
6
|
export type BannerType = "notice" | "success" | "warning" | "error";
|
|
7
|
+
type TokensType = keyof typeof tokens;
|
|
8
|
+
type Prefixes = TokensType extends `${infer Prefix}-${string}` ? Prefix : never;
|
|
9
|
+
type ExtractTokens<T extends string> = Extract<TokensType, `${T}-${string}`>;
|
|
10
|
+
type Tokenize<T extends Prefixes> = ExtractTokens<T> extends `${T}-${infer Value}` ? Value : never;
|
|
11
|
+
type Colors = Tokenize<"color">;
|
|
12
|
+
export interface BannerProps {
|
|
13
|
+
readonly children: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Sets the status-based theme of the Banner
|
|
16
|
+
*/
|
|
17
|
+
readonly type: BannerType;
|
|
18
|
+
/**
|
|
19
|
+
* Accepts props for Button. Default action uses a 'subtle' Button
|
|
20
|
+
*/
|
|
21
|
+
readonly primaryAction?: ButtonProps;
|
|
22
|
+
/**
|
|
23
|
+
* Set to false to hide the dismiss button
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
readonly dismissible?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Use to override the default status Icon
|
|
29
|
+
*/
|
|
30
|
+
readonly icon?: IconNames;
|
|
31
|
+
/**
|
|
32
|
+
* Callback to be called when the Banner is dismissed.
|
|
33
|
+
*/
|
|
34
|
+
onDismiss?(): void;
|
|
35
|
+
/**
|
|
36
|
+
* When provided, Banner's visibility is controlled by this value
|
|
37
|
+
* @default undefined
|
|
38
|
+
*/
|
|
39
|
+
readonly controlledVisiblity?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface BannerProviderProps extends PropsWithChildren {
|
|
42
|
+
/**
|
|
43
|
+
* Sets the status-based theme of the Banner.
|
|
44
|
+
*/
|
|
45
|
+
readonly type: BannerType;
|
|
46
|
+
/**
|
|
47
|
+
* When provided, Banner's visibility is controlled by this value.
|
|
48
|
+
*/
|
|
49
|
+
readonly visible?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Callback to be called when the Banner is dismissed.
|
|
52
|
+
*/
|
|
53
|
+
readonly onDismiss?: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Icon to be used for the Banner.
|
|
56
|
+
* If you want to remove the icon, set to false.
|
|
57
|
+
* @default <Banner.Icon/>
|
|
58
|
+
*/
|
|
59
|
+
readonly icon?: React.ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* Dismiss button to be used for the Banner.
|
|
62
|
+
* If you want to remove the dismiss button, set to false.
|
|
63
|
+
* @default <Banner.DismissButton/>
|
|
64
|
+
*/
|
|
65
|
+
readonly dismissButton?: React.ReactNode;
|
|
66
|
+
/**
|
|
67
|
+
* **Use at your own risk:** Custom class names for specific elements. This should only be used as a
|
|
68
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
69
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
70
|
+
*/
|
|
71
|
+
readonly UNSAFE_className?: {
|
|
72
|
+
readonly container?: string;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
76
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
77
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
78
|
+
*/
|
|
79
|
+
readonly UNSAFE_style?: {
|
|
80
|
+
readonly container?: CSSProperties;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export interface BannerContentProps extends PropsWithChildren {
|
|
84
|
+
/**
|
|
85
|
+
* **Use at your own risk:** Custom class names for specific elements. This should only be used as a
|
|
86
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
87
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
88
|
+
*/
|
|
89
|
+
readonly UNSAFE_className?: {
|
|
90
|
+
readonly container?: string;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
94
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
95
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
96
|
+
*/
|
|
97
|
+
readonly UNSAFE_style?: {
|
|
98
|
+
readonly container?: CSSProperties;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export interface BannerDismissButtonProps {
|
|
102
|
+
readonly onClick?: ButtonDismissProps["onClick"];
|
|
103
|
+
readonly ariaLabel?: ButtonDismissProps["ariaLabel"];
|
|
104
|
+
/**
|
|
105
|
+
* **Use at your own risk:** Custom class names for specific elements. This should only be used as a
|
|
106
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
107
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
108
|
+
*/
|
|
109
|
+
readonly UNSAFE_className?: {
|
|
110
|
+
readonly container?: string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
114
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
115
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
116
|
+
*/
|
|
117
|
+
readonly UNSAFE_style?: {
|
|
118
|
+
readonly container?: CSSProperties;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export interface BannerIconProps extends Partial<Omit<IconProps, "UNSAFE_className" | "UNSAFE_style">> {
|
|
122
|
+
/**
|
|
123
|
+
* Sets the background color of the icon.
|
|
124
|
+
*/
|
|
125
|
+
readonly backgroundColor?: Colors;
|
|
126
|
+
/**
|
|
127
|
+
* **Use at your own risk:** Custom class names for specific elements. This should only be used as a
|
|
128
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
129
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
130
|
+
*/
|
|
131
|
+
readonly UNSAFE_className?: {
|
|
132
|
+
readonly container?: string;
|
|
133
|
+
readonly icon?: IconProps["UNSAFE_className"];
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
137
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
138
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
139
|
+
*/
|
|
140
|
+
readonly UNSAFE_style?: {
|
|
141
|
+
readonly container?: CSSProperties;
|
|
142
|
+
readonly icon?: IconProps["UNSAFE_style"];
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
export interface BannerActionProps extends Omit<ButtonProps, "UNSAFE_className" | "UNSAFE_style"> {
|
|
146
|
+
/**
|
|
147
|
+
* **Use at your own risk:** Custom class names for specific elements. This should only be used as a
|
|
148
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
149
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
150
|
+
*/
|
|
151
|
+
readonly UNSAFE_className?: {
|
|
152
|
+
readonly container?: string;
|
|
153
|
+
readonly button?: ButtonProps["UNSAFE_className"];
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
157
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
158
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
159
|
+
*/
|
|
160
|
+
readonly UNSAFE_style?: {
|
|
161
|
+
readonly container?: CSSProperties;
|
|
162
|
+
readonly button?: ButtonProps["UNSAFE_style"];
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BannerType } from "./Banner.types";
|
|
2
|
+
interface BannerContextValue {
|
|
3
|
+
/**
|
|
4
|
+
* The status-based theme of the Banner.
|
|
5
|
+
*/
|
|
6
|
+
readonly type: BannerType;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the Banner is currently visible.
|
|
9
|
+
*/
|
|
10
|
+
readonly isVisible: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the visibility of the Banner.
|
|
13
|
+
*/
|
|
14
|
+
readonly setIsVisible: (visible: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const BannerContextProvider: import("react").Provider<BannerContextValue>;
|
|
17
|
+
export declare function useBanner(): BannerContextValue;
|
|
18
|
+
export {};
|
package/dist/Banner/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var Banner = require('../Banner-cjs.js');
|
|
4
|
+
require('../tslib.es6-cjs.js');
|
|
4
5
|
require('react');
|
|
5
6
|
require('classnames');
|
|
6
7
|
require('../useResizeObserver-cjs.js');
|
|
@@ -9,15 +10,13 @@ require('../throttle-cjs.js');
|
|
|
9
10
|
require('../debounce-cjs.js');
|
|
10
11
|
require('../isObjectLike-cjs.js');
|
|
11
12
|
require('../isSymbol-cjs.js');
|
|
12
|
-
require('../BannerIcon-cjs.js');
|
|
13
13
|
require('../Icon-cjs.js');
|
|
14
14
|
require('@jobber/design');
|
|
15
|
-
require('../
|
|
16
|
-
require('../Typography-cjs.js');
|
|
15
|
+
require('../ButtonDismiss-cjs.js');
|
|
17
16
|
require('../Button-cjs.js');
|
|
18
17
|
require('react-router-dom');
|
|
19
|
-
require('../
|
|
20
|
-
require('../
|
|
18
|
+
require('../Typography-cjs.js');
|
|
19
|
+
require('../Text-cjs.js');
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
|
package/dist/Banner/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Banner } from "./Banner";
|
|
2
|
-
export { BannerType } from "./Banner.types";
|
|
2
|
+
export type { BannerType, BannerDismissButtonProps, BannerProviderProps, BannerContentProps, BannerIconProps, } from "./Banner.types";
|
package/dist/Banner/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { B as Banner } from '../Banner-es.js';
|
|
2
|
+
import '../tslib.es6-es.js';
|
|
2
3
|
import 'react';
|
|
3
4
|
import 'classnames';
|
|
4
5
|
import '../useResizeObserver-es.js';
|
|
@@ -7,12 +8,10 @@ import '../throttle-es.js';
|
|
|
7
8
|
import '../debounce-es.js';
|
|
8
9
|
import '../isObjectLike-es.js';
|
|
9
10
|
import '../isSymbol-es.js';
|
|
10
|
-
import '../BannerIcon-es.js';
|
|
11
11
|
import '../Icon-es.js';
|
|
12
12
|
import '@jobber/design';
|
|
13
|
-
import '../
|
|
14
|
-
import '../Typography-es.js';
|
|
13
|
+
import '../ButtonDismiss-es.js';
|
|
15
14
|
import '../Button-es.js';
|
|
16
15
|
import 'react-router-dom';
|
|
17
|
-
import '../
|
|
18
|
-
import '../
|
|
16
|
+
import '../Typography-es.js';
|
|
17
|
+
import '../Text-es.js';
|
package/dist/Banner-cjs.js
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-cjs.js');
|
|
3
4
|
var React = require('react');
|
|
4
5
|
var classnames = require('classnames');
|
|
5
6
|
var useResizeObserver = require('./useResizeObserver-cjs.js');
|
|
6
|
-
var
|
|
7
|
-
var Text = require('./Text-cjs.js');
|
|
8
|
-
var Button = require('./Button-cjs.js');
|
|
7
|
+
var Icon = require('./Icon-cjs.js');
|
|
9
8
|
var ButtonDismiss = require('./ButtonDismiss-cjs.js');
|
|
9
|
+
var Button = require('./Button-cjs.js');
|
|
10
|
+
var Text = require('./Text-cjs.js');
|
|
11
|
+
|
|
12
|
+
var styles = {"banner":"ucGelS5nNm0-","notice":"_5VzH3Cz9ps8-","error":"_16jyB9OYJIs-","warning":"_4h-6cc8lZo8-","success":"k7T2IV0R8Q0-","bannerChildren":"dG2vHE6g8f0-","bannerContent":"j9IeihCCYxI-","medium":"D5X29shmSr0-","bannerAction":"W0pSTO-oRmk-","closeButton":"-IYYDBmq2Q0-","iconWrapper":"BQhacg0OlMs-","successIcon":"wc5os7zGk30-","errorIcon":"R0t3TbhBBqo-","warningIcon":"i5fVmbzbYVM-","noticeIcon":"onwyp3UI3so-","spinning":"fZdByimVT5Q-"};
|
|
13
|
+
|
|
14
|
+
const BannerContext = React.createContext({
|
|
15
|
+
type: "success",
|
|
16
|
+
isVisible: true,
|
|
17
|
+
setIsVisible: () => {
|
|
18
|
+
// noop
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const BannerContextProvider = BannerContext.Provider;
|
|
22
|
+
function useBanner() {
|
|
23
|
+
return React.useContext(BannerContext);
|
|
24
|
+
}
|
|
10
25
|
|
|
11
26
|
function Banner({ children, type, primaryAction, dismissible = true, icon, onDismiss, controlledVisiblity, }) {
|
|
12
|
-
const [showBanner, setShowBanner] = React.useState(true);
|
|
13
|
-
const bannerIcon = icon || getBannerIcon(type);
|
|
14
|
-
const controlledVisible = controlledVisiblity !== null && controlledVisiblity !== void 0 ? controlledVisiblity : true;
|
|
15
|
-
const visible = controlledVisible && showBanner;
|
|
16
|
-
const bannerWidths = {
|
|
17
|
-
small: 320,
|
|
18
|
-
medium: 480,
|
|
19
|
-
};
|
|
20
|
-
const [bannerRef, { width: bannerWidth = bannerWidths.small }] = useResizeObserver.useResizeObserver.useResizeObserver({
|
|
21
|
-
widths: bannerWidths,
|
|
22
|
-
});
|
|
23
27
|
if (primaryAction != undefined) {
|
|
24
28
|
primaryAction = Object.assign({
|
|
25
29
|
size: "small",
|
|
@@ -27,27 +31,85 @@ function Banner({ children, type, primaryAction, dismissible = true, icon, onDis
|
|
|
27
31
|
variation: "subtle",
|
|
28
32
|
}, primaryAction);
|
|
29
33
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
React.createElement(Button.Button, Object.assign({}, primaryAction))))),
|
|
42
|
-
dismissible && (React.createElement("div", { className: BannerIcon.styles.closeButton },
|
|
43
|
-
React.createElement(ButtonDismiss.ButtonDismiss, { ariaLabel: "Dismiss notification", onClick: handleClose })))));
|
|
44
|
-
function handleClose() {
|
|
45
|
-
if (typeof controlledVisiblity === "undefined") {
|
|
46
|
-
setShowBanner(!showBanner);
|
|
34
|
+
return (React.createElement(Banner.Provider, { type: type, visible: controlledVisiblity, onDismiss: onDismiss, icon: React.createElement(Banner.Icon, { name: icon }), dismissButton: dismissible && React.createElement(Banner.DismissButton, null) },
|
|
35
|
+
React.createElement(Banner.Content, null, children),
|
|
36
|
+
primaryAction && React.createElement(Banner.Action, Object.assign({}, primaryAction))));
|
|
37
|
+
}
|
|
38
|
+
Banner.Provider = function BannerProvider({ children, visible, type, onDismiss, icon, dismissButton, UNSAFE_className, UNSAFE_style, }) {
|
|
39
|
+
const [isVisible, _setIsVisible] = React.useState(true);
|
|
40
|
+
const showBanner = visible !== null && visible !== void 0 ? visible : isVisible;
|
|
41
|
+
const setIsVisible = (newValue) => {
|
|
42
|
+
// Only update internal visibility if it's not controlled by the parent.
|
|
43
|
+
if (typeof visible === "undefined") {
|
|
44
|
+
_setIsVisible(newValue);
|
|
47
45
|
}
|
|
48
46
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
49
|
-
}
|
|
47
|
+
};
|
|
48
|
+
return (React.createElement(BannerContextProvider, { value: {
|
|
49
|
+
type,
|
|
50
|
+
isVisible: showBanner,
|
|
51
|
+
setIsVisible,
|
|
52
|
+
} },
|
|
53
|
+
React.createElement(InternalWrapper, { icon: icon, dismissButton: dismissButton, UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style }, children)));
|
|
54
|
+
};
|
|
55
|
+
function InternalWrapper({ children, icon, dismissButton, UNSAFE_className, UNSAFE_style, }) {
|
|
56
|
+
const { isVisible, type } = useBanner();
|
|
57
|
+
const bannerWidths = {
|
|
58
|
+
small: 320,
|
|
59
|
+
medium: 480,
|
|
60
|
+
};
|
|
61
|
+
const [bannerRef, { width: bannerWidth = bannerWidths.small }] = useResizeObserver.useResizeObserver.useResizeObserver({
|
|
62
|
+
widths: bannerWidths,
|
|
63
|
+
});
|
|
64
|
+
const bannerClassNames = classnames(styles.banner, [styles[type]], {
|
|
65
|
+
[styles.medium]: bannerWidth >= bannerWidths.medium,
|
|
66
|
+
}, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container);
|
|
67
|
+
if (!isVisible)
|
|
68
|
+
return null;
|
|
69
|
+
return (React.createElement("div", { ref: bannerRef, className: bannerClassNames, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container, role: type === "error" ? "alert" : "status" },
|
|
70
|
+
React.createElement("div", { className: styles.bannerContent }, icon !== null && icon !== void 0 ? icon : React.createElement(Banner.Icon, null),
|
|
71
|
+
children), dismissButton !== null && dismissButton !== void 0 ? dismissButton : React.createElement(Banner.DismissButton, null)));
|
|
50
72
|
}
|
|
73
|
+
Banner.Icon = function BannerIcon(_a) {
|
|
74
|
+
var { backgroundColor, UNSAFE_className, UNSAFE_style } = _a, iconProps = tslib_es6.__rest(_a, ["backgroundColor", "UNSAFE_className", "UNSAFE_style"]);
|
|
75
|
+
const { type } = useBanner();
|
|
76
|
+
const name = iconProps.name || getBannerIcon(type);
|
|
77
|
+
const color = iconProps.customColor ? undefined : "surface";
|
|
78
|
+
const size = "small";
|
|
79
|
+
if (!name)
|
|
80
|
+
return null;
|
|
81
|
+
const overrideStyles = {};
|
|
82
|
+
if (backgroundColor) {
|
|
83
|
+
overrideStyles.backgroundColor = `var(--color-${backgroundColor})`;
|
|
84
|
+
}
|
|
85
|
+
const classNames = classnames(styles.iconWrapper, styles[`${type}Icon`], UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container);
|
|
86
|
+
return (React.createElement("span", { className: classNames, style: Object.assign(Object.assign({}, overrideStyles), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container) },
|
|
87
|
+
React.createElement(Icon.Icon, Object.assign({ color: color, size: size, UNSAFE_className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.icon, UNSAFE_style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.icon }, iconProps, { name: name }))));
|
|
88
|
+
};
|
|
89
|
+
Banner.Content = function BannerContent(props) {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
let children = props.children;
|
|
92
|
+
if (children && typeof children === "string") {
|
|
93
|
+
children = React.createElement(Text.Text, null, children);
|
|
94
|
+
}
|
|
95
|
+
return (React.createElement("div", { className: classnames(styles.bannerChildren, (_a = props.UNSAFE_className) === null || _a === void 0 ? void 0 : _a.container), style: (_b = props.UNSAFE_style) === null || _b === void 0 ? void 0 : _b.container }, children));
|
|
96
|
+
};
|
|
97
|
+
Banner.DismissButton = function DismissButton(props) {
|
|
98
|
+
var _a, _b, _c, _d;
|
|
99
|
+
const { setIsVisible } = useBanner();
|
|
100
|
+
const ariaLabel = (_a = props.ariaLabel) !== null && _a !== void 0 ? _a : "Dismiss notification";
|
|
101
|
+
const onClick = (_b = props.onClick) !== null && _b !== void 0 ? _b : (() => {
|
|
102
|
+
setIsVisible(false);
|
|
103
|
+
});
|
|
104
|
+
return (React.createElement("div", { className: classnames(styles.closeButton, (_c = props.UNSAFE_className) === null || _c === void 0 ? void 0 : _c.container), style: (_d = props.UNSAFE_style) === null || _d === void 0 ? void 0 : _d.container },
|
|
105
|
+
React.createElement(ButtonDismiss.ButtonDismiss, { onClick: onClick, ariaLabel: ariaLabel })));
|
|
106
|
+
};
|
|
107
|
+
Banner.Action = function Action(_a) {
|
|
108
|
+
var { UNSAFE_className, UNSAFE_style } = _a, buttonProps = tslib_es6.__rest(_a, ["UNSAFE_className", "UNSAFE_style"]);
|
|
109
|
+
const classNames = classnames(styles.bannerAction, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container);
|
|
110
|
+
return (React.createElement("div", { className: classNames, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container },
|
|
111
|
+
React.createElement(Button.Button, Object.assign({ size: "small", type: "primary", variation: "subtle", UNSAFE_className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.button, UNSAFE_style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.button }, buttonProps))));
|
|
112
|
+
};
|
|
51
113
|
function getBannerIcon(type) {
|
|
52
114
|
switch (type) {
|
|
53
115
|
case "notice":
|
|
@@ -60,13 +122,5 @@ function getBannerIcon(type) {
|
|
|
60
122
|
return "alert";
|
|
61
123
|
}
|
|
62
124
|
}
|
|
63
|
-
function BannerChildren({ children, }) {
|
|
64
|
-
if (!children)
|
|
65
|
-
return React.createElement(React.Fragment, null);
|
|
66
|
-
if (children && typeof children === "string") {
|
|
67
|
-
return React.createElement(Text.Text, null, children);
|
|
68
|
-
}
|
|
69
|
-
return React.createElement(React.Fragment, null, children);
|
|
70
|
-
}
|
|
71
125
|
|
|
72
126
|
exports.Banner = Banner;
|
package/dist/Banner-es.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { _ as __rest } from './tslib.es6-es.js';
|
|
2
|
+
import React__default, { createContext, useContext, useState } from 'react';
|
|
2
3
|
import classnames from 'classnames';
|
|
3
4
|
import { u as useResizeObserver } from './useResizeObserver-es.js';
|
|
4
|
-
import {
|
|
5
|
-
import { T as Text } from './Text-es.js';
|
|
6
|
-
import { B as Button } from './Button-es.js';
|
|
5
|
+
import { I as Icon } from './Icon-es.js';
|
|
7
6
|
import { B as ButtonDismiss } from './ButtonDismiss-es.js';
|
|
7
|
+
import { B as Button } from './Button-es.js';
|
|
8
|
+
import { T as Text } from './Text-es.js';
|
|
9
|
+
|
|
10
|
+
var styles = {"banner":"ucGelS5nNm0-","notice":"_5VzH3Cz9ps8-","error":"_16jyB9OYJIs-","warning":"_4h-6cc8lZo8-","success":"k7T2IV0R8Q0-","bannerChildren":"dG2vHE6g8f0-","bannerContent":"j9IeihCCYxI-","medium":"D5X29shmSr0-","bannerAction":"W0pSTO-oRmk-","closeButton":"-IYYDBmq2Q0-","iconWrapper":"BQhacg0OlMs-","successIcon":"wc5os7zGk30-","errorIcon":"R0t3TbhBBqo-","warningIcon":"i5fVmbzbYVM-","noticeIcon":"onwyp3UI3so-","spinning":"fZdByimVT5Q-"};
|
|
11
|
+
|
|
12
|
+
const BannerContext = createContext({
|
|
13
|
+
type: "success",
|
|
14
|
+
isVisible: true,
|
|
15
|
+
setIsVisible: () => {
|
|
16
|
+
// noop
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
const BannerContextProvider = BannerContext.Provider;
|
|
20
|
+
function useBanner() {
|
|
21
|
+
return useContext(BannerContext);
|
|
22
|
+
}
|
|
8
23
|
|
|
9
24
|
function Banner({ children, type, primaryAction, dismissible = true, icon, onDismiss, controlledVisiblity, }) {
|
|
10
|
-
const [showBanner, setShowBanner] = useState(true);
|
|
11
|
-
const bannerIcon = icon || getBannerIcon(type);
|
|
12
|
-
const controlledVisible = controlledVisiblity !== null && controlledVisiblity !== void 0 ? controlledVisiblity : true;
|
|
13
|
-
const visible = controlledVisible && showBanner;
|
|
14
|
-
const bannerWidths = {
|
|
15
|
-
small: 320,
|
|
16
|
-
medium: 480,
|
|
17
|
-
};
|
|
18
|
-
const [bannerRef, { width: bannerWidth = bannerWidths.small }] = useResizeObserver.useResizeObserver({
|
|
19
|
-
widths: bannerWidths,
|
|
20
|
-
});
|
|
21
25
|
if (primaryAction != undefined) {
|
|
22
26
|
primaryAction = Object.assign({
|
|
23
27
|
size: "small",
|
|
@@ -25,27 +29,85 @@ function Banner({ children, type, primaryAction, dismissible = true, icon, onDis
|
|
|
25
29
|
variation: "subtle",
|
|
26
30
|
}, primaryAction);
|
|
27
31
|
}
|
|
32
|
+
return (React__default.createElement(Banner.Provider, { type: type, visible: controlledVisiblity, onDismiss: onDismiss, icon: React__default.createElement(Banner.Icon, { name: icon }), dismissButton: dismissible && React__default.createElement(Banner.DismissButton, null) },
|
|
33
|
+
React__default.createElement(Banner.Content, null, children),
|
|
34
|
+
primaryAction && React__default.createElement(Banner.Action, Object.assign({}, primaryAction))));
|
|
35
|
+
}
|
|
36
|
+
Banner.Provider = function BannerProvider({ children, visible, type, onDismiss, icon, dismissButton, UNSAFE_className, UNSAFE_style, }) {
|
|
37
|
+
const [isVisible, _setIsVisible] = useState(true);
|
|
38
|
+
const showBanner = visible !== null && visible !== void 0 ? visible : isVisible;
|
|
39
|
+
const setIsVisible = (newValue) => {
|
|
40
|
+
// Only update internal visibility if it's not controlled by the parent.
|
|
41
|
+
if (typeof visible === "undefined") {
|
|
42
|
+
_setIsVisible(newValue);
|
|
43
|
+
}
|
|
44
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
45
|
+
};
|
|
46
|
+
return (React__default.createElement(BannerContextProvider, { value: {
|
|
47
|
+
type,
|
|
48
|
+
isVisible: showBanner,
|
|
49
|
+
setIsVisible,
|
|
50
|
+
} },
|
|
51
|
+
React__default.createElement(InternalWrapper, { icon: icon, dismissButton: dismissButton, UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style }, children)));
|
|
52
|
+
};
|
|
53
|
+
function InternalWrapper({ children, icon, dismissButton, UNSAFE_className, UNSAFE_style, }) {
|
|
54
|
+
const { isVisible, type } = useBanner();
|
|
55
|
+
const bannerWidths = {
|
|
56
|
+
small: 320,
|
|
57
|
+
medium: 480,
|
|
58
|
+
};
|
|
59
|
+
const [bannerRef, { width: bannerWidth = bannerWidths.small }] = useResizeObserver.useResizeObserver({
|
|
60
|
+
widths: bannerWidths,
|
|
61
|
+
});
|
|
28
62
|
const bannerClassNames = classnames(styles.banner, [styles[type]], {
|
|
29
63
|
[styles.medium]: bannerWidth >= bannerWidths.medium,
|
|
30
|
-
});
|
|
31
|
-
if (!
|
|
64
|
+
}, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container);
|
|
65
|
+
if (!isVisible)
|
|
32
66
|
return null;
|
|
33
|
-
return (React__default.createElement("div", { className: bannerClassNames,
|
|
34
|
-
React__default.createElement("div", { className: styles.bannerContent },
|
|
35
|
-
|
|
36
|
-
React__default.createElement("div", { className: styles.bannerChildren },
|
|
37
|
-
React__default.createElement(BannerChildren, null, children)),
|
|
38
|
-
primaryAction && (React__default.createElement("div", { className: styles.bannerAction },
|
|
39
|
-
React__default.createElement(Button, Object.assign({}, primaryAction))))),
|
|
40
|
-
dismissible && (React__default.createElement("div", { className: styles.closeButton },
|
|
41
|
-
React__default.createElement(ButtonDismiss, { ariaLabel: "Dismiss notification", onClick: handleClose })))));
|
|
42
|
-
function handleClose() {
|
|
43
|
-
if (typeof controlledVisiblity === "undefined") {
|
|
44
|
-
setShowBanner(!showBanner);
|
|
45
|
-
}
|
|
46
|
-
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
47
|
-
}
|
|
67
|
+
return (React__default.createElement("div", { ref: bannerRef, className: bannerClassNames, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container, role: type === "error" ? "alert" : "status" },
|
|
68
|
+
React__default.createElement("div", { className: styles.bannerContent }, icon !== null && icon !== void 0 ? icon : React__default.createElement(Banner.Icon, null),
|
|
69
|
+
children), dismissButton !== null && dismissButton !== void 0 ? dismissButton : React__default.createElement(Banner.DismissButton, null)));
|
|
48
70
|
}
|
|
71
|
+
Banner.Icon = function BannerIcon(_a) {
|
|
72
|
+
var { backgroundColor, UNSAFE_className, UNSAFE_style } = _a, iconProps = __rest(_a, ["backgroundColor", "UNSAFE_className", "UNSAFE_style"]);
|
|
73
|
+
const { type } = useBanner();
|
|
74
|
+
const name = iconProps.name || getBannerIcon(type);
|
|
75
|
+
const color = iconProps.customColor ? undefined : "surface";
|
|
76
|
+
const size = "small";
|
|
77
|
+
if (!name)
|
|
78
|
+
return null;
|
|
79
|
+
const overrideStyles = {};
|
|
80
|
+
if (backgroundColor) {
|
|
81
|
+
overrideStyles.backgroundColor = `var(--color-${backgroundColor})`;
|
|
82
|
+
}
|
|
83
|
+
const classNames = classnames(styles.iconWrapper, styles[`${type}Icon`], UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container);
|
|
84
|
+
return (React__default.createElement("span", { className: classNames, style: Object.assign(Object.assign({}, overrideStyles), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container) },
|
|
85
|
+
React__default.createElement(Icon, Object.assign({ color: color, size: size, UNSAFE_className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.icon, UNSAFE_style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.icon }, iconProps, { name: name }))));
|
|
86
|
+
};
|
|
87
|
+
Banner.Content = function BannerContent(props) {
|
|
88
|
+
var _a, _b;
|
|
89
|
+
let children = props.children;
|
|
90
|
+
if (children && typeof children === "string") {
|
|
91
|
+
children = React__default.createElement(Text, null, children);
|
|
92
|
+
}
|
|
93
|
+
return (React__default.createElement("div", { className: classnames(styles.bannerChildren, (_a = props.UNSAFE_className) === null || _a === void 0 ? void 0 : _a.container), style: (_b = props.UNSAFE_style) === null || _b === void 0 ? void 0 : _b.container }, children));
|
|
94
|
+
};
|
|
95
|
+
Banner.DismissButton = function DismissButton(props) {
|
|
96
|
+
var _a, _b, _c, _d;
|
|
97
|
+
const { setIsVisible } = useBanner();
|
|
98
|
+
const ariaLabel = (_a = props.ariaLabel) !== null && _a !== void 0 ? _a : "Dismiss notification";
|
|
99
|
+
const onClick = (_b = props.onClick) !== null && _b !== void 0 ? _b : (() => {
|
|
100
|
+
setIsVisible(false);
|
|
101
|
+
});
|
|
102
|
+
return (React__default.createElement("div", { className: classnames(styles.closeButton, (_c = props.UNSAFE_className) === null || _c === void 0 ? void 0 : _c.container), style: (_d = props.UNSAFE_style) === null || _d === void 0 ? void 0 : _d.container },
|
|
103
|
+
React__default.createElement(ButtonDismiss, { onClick: onClick, ariaLabel: ariaLabel })));
|
|
104
|
+
};
|
|
105
|
+
Banner.Action = function Action(_a) {
|
|
106
|
+
var { UNSAFE_className, UNSAFE_style } = _a, buttonProps = __rest(_a, ["UNSAFE_className", "UNSAFE_style"]);
|
|
107
|
+
const classNames = classnames(styles.bannerAction, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container);
|
|
108
|
+
return (React__default.createElement("div", { className: classNames, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container },
|
|
109
|
+
React__default.createElement(Button, Object.assign({ size: "small", type: "primary", variation: "subtle", UNSAFE_className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.button, UNSAFE_style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.button }, buttonProps))));
|
|
110
|
+
};
|
|
49
111
|
function getBannerIcon(type) {
|
|
50
112
|
switch (type) {
|
|
51
113
|
case "notice":
|
|
@@ -58,13 +120,5 @@ function getBannerIcon(type) {
|
|
|
58
120
|
return "alert";
|
|
59
121
|
}
|
|
60
122
|
}
|
|
61
|
-
function BannerChildren({ children, }) {
|
|
62
|
-
if (!children)
|
|
63
|
-
return React__default.createElement(React__default.Fragment, null);
|
|
64
|
-
if (children && typeof children === "string") {
|
|
65
|
-
return React__default.createElement(Text, null, children);
|
|
66
|
-
}
|
|
67
|
-
return React__default.createElement(React__default.Fragment, null, children);
|
|
68
|
-
}
|
|
69
123
|
|
|
70
124
|
export { Banner as B };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export declare const CheckboxRebuilt: React.ForwardRefExoticComponent<Omit<import("./Checkbox.types").BaseCheckboxProps, "children" | "onChange" | "label" | "description"> & {
|
|
3
3
|
label?: string | React.ReactElement;
|
|
4
|
-
description?:
|
|
4
|
+
description?: React.ReactNode;
|
|
5
5
|
onChange?(newValue: boolean, event: React.ChangeEvent<HTMLInputElement>): void;
|
|
6
6
|
version: 2;
|
|
7
7
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement } from "react";
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { XOR } from "ts-xor";
|
|
3
3
|
export interface BaseCheckboxProps {
|
|
4
4
|
/**
|
|
@@ -32,7 +32,7 @@ export interface BaseCheckboxProps {
|
|
|
32
32
|
/**
|
|
33
33
|
* Further description of the label
|
|
34
34
|
*/
|
|
35
|
-
readonly description?:
|
|
35
|
+
readonly description?: ReactNode;
|
|
36
36
|
/**
|
|
37
37
|
* ID for the checkbox input
|
|
38
38
|
*/
|
|
@@ -78,7 +78,7 @@ export type CheckboxRebuiltProps = Omit<BaseCheckboxProps, "label" | "descriptio
|
|
|
78
78
|
* String will be rendered with the default markup.
|
|
79
79
|
* ReactElement will be rendered with provided positioning.
|
|
80
80
|
*/
|
|
81
|
-
description?:
|
|
81
|
+
description?: ReactNode;
|
|
82
82
|
/**
|
|
83
83
|
* Called when the checkbox value changes.
|
|
84
84
|
* Includes the change event as a second argument.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
2
|
interface FormFieldDescriptionProps {
|
|
3
3
|
readonly id: string;
|
|
4
|
-
readonly description?:
|
|
4
|
+
readonly description?: ReactNode;
|
|
5
5
|
readonly visible?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare function FormFieldDescription({ id, description, visible, }: FormFieldDescriptionProps): React.JSX.Element | null;
|
package/dist/FormField-cjs.js
CHANGED
|
@@ -69,8 +69,8 @@ function AffixIcon({ icon, onClick, ariaLabel, variation = "prefix", size, }) {
|
|
|
69
69
|
function FormFieldDescription({ id, description, visible = true, }) {
|
|
70
70
|
if (!visible)
|
|
71
71
|
return null;
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
const useStringFormat = !description || typeof description === "string";
|
|
73
|
+
return (React.createElement("div", { id: id, className: styles$1.description }, useStringFormat ? (React.createElement(Text.Text, { size: "small", variation: "subdued" }, description)) : (description)));
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
var styles = {"clearInput":"YmRTd-KeXv4-","spinning":"B25z9B8I3gs-"};
|
package/dist/FormField-es.js
CHANGED
|
@@ -67,8 +67,8 @@ function AffixIcon({ icon, onClick, ariaLabel, variation = "prefix", size, }) {
|
|
|
67
67
|
function FormFieldDescription({ id, description, visible = true, }) {
|
|
68
68
|
if (!visible)
|
|
69
69
|
return null;
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const useStringFormat = !description || typeof description === "string";
|
|
71
|
+
return (React__default.createElement("div", { id: id, className: styles$1.description }, useStringFormat ? (React__default.createElement(Text, { size: "small", variation: "subdued" }, description)) : (description)));
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
var styles = {"clearInput":"YmRTd-KeXv4-","spinning":"B25z9B8I3gs-"};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEvent, FocusEvent, KeyboardEvent } from "react";
|
|
1
|
+
import { ChangeEvent, FocusEvent, KeyboardEvent, ReactNode } from "react";
|
|
2
2
|
export interface UseInputEmailFormFieldProps {
|
|
3
3
|
readonly id: string;
|
|
4
4
|
readonly name: string;
|
|
@@ -6,7 +6,7 @@ export interface UseInputEmailFormFieldProps {
|
|
|
6
6
|
readonly autofocus?: boolean;
|
|
7
7
|
readonly error?: string;
|
|
8
8
|
readonly inline?: boolean;
|
|
9
|
-
readonly description?:
|
|
9
|
+
readonly description?: ReactNode;
|
|
10
10
|
readonly invalid?: boolean;
|
|
11
11
|
readonly value?: string;
|
|
12
12
|
readonly handleChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
2
|
import { CommonFormFieldProps, FormFieldProps } from "../FormField";
|
|
3
3
|
export type InputNumberVersion = 1 | 2 | undefined;
|
|
4
4
|
export interface InputNumberRebuiltProps extends Omit<CommonFormFieldProps, "version">, Pick<FormFieldProps, "onFocus" | "onBlur" | "inputRef" | "readonly" | "size"> {
|
|
@@ -6,7 +6,7 @@ export interface InputNumberRebuiltProps extends Omit<CommonFormFieldProps, "ver
|
|
|
6
6
|
readonly autocomplete?: boolean;
|
|
7
7
|
readonly autoFocus?: boolean;
|
|
8
8
|
readonly defaultValue?: number;
|
|
9
|
-
readonly description?:
|
|
9
|
+
readonly description?: ReactNode;
|
|
10
10
|
readonly error?: string;
|
|
11
11
|
readonly formatOptions?: Intl.NumberFormatOptions;
|
|
12
12
|
readonly identifier?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEvent, FocusEvent, KeyboardEvent } from "react";
|
|
1
|
+
import { ChangeEvent, FocusEvent, KeyboardEvent, ReactNode } from "react";
|
|
2
2
|
export interface useInputPhoneFormFieldProps {
|
|
3
3
|
/**
|
|
4
4
|
* The html id for the field
|
|
@@ -22,7 +22,7 @@ export interface useInputPhoneFormFieldProps {
|
|
|
22
22
|
/**
|
|
23
23
|
* Further description of the input, can be used for a hint.
|
|
24
24
|
*/
|
|
25
|
-
readonly description?:
|
|
25
|
+
readonly description?: ReactNode;
|
|
26
26
|
/**
|
|
27
27
|
* Callback for when the field value changes
|
|
28
28
|
*/
|
|
@@ -5,7 +5,7 @@ export declare const InputText: React.ForwardRefExoticComponent<({
|
|
|
5
5
|
readonly rows?: (number | import("./InputText.types").RowRange) | undefined;
|
|
6
6
|
readonly id?: string | undefined;
|
|
7
7
|
readonly align?: ("center" | "right") | undefined;
|
|
8
|
-
readonly description?:
|
|
8
|
+
readonly description?: React.ReactNode;
|
|
9
9
|
readonly disabled?: boolean | undefined;
|
|
10
10
|
readonly showMiniLabel?: boolean | undefined;
|
|
11
11
|
readonly invalid?: boolean | undefined;
|
|
@@ -39,7 +39,7 @@ export declare const InputText: React.ForwardRefExoticComponent<({
|
|
|
39
39
|
multiline?: boolean | undefined;
|
|
40
40
|
readonly id?: string | undefined;
|
|
41
41
|
readonly align?: ("center" | "right") | undefined;
|
|
42
|
-
readonly description?:
|
|
42
|
+
readonly description?: React.ReactNode;
|
|
43
43
|
readonly disabled?: boolean | undefined;
|
|
44
44
|
readonly showMiniLabel?: boolean | undefined;
|
|
45
45
|
readonly invalid?: boolean | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEvent, FocusEvent, KeyboardEvent } from "react";
|
|
1
|
+
import { ChangeEvent, FocusEvent, KeyboardEvent, ReactNode } from "react";
|
|
2
2
|
export interface useInputTextFormFieldProps extends React.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement> {
|
|
3
3
|
/**
|
|
4
4
|
* The html id for the field
|
|
@@ -22,7 +22,7 @@ export interface useInputTextFormFieldProps extends React.InputHTMLAttributes<HT
|
|
|
22
22
|
/**
|
|
23
23
|
* Further description of the input, can be used for a hint.
|
|
24
24
|
*/
|
|
25
|
-
readonly description?:
|
|
25
|
+
readonly description?: ReactNode;
|
|
26
26
|
/**
|
|
27
27
|
* Callback for when the field value changes
|
|
28
28
|
*/
|
|
@@ -187,7 +187,7 @@ export declare function useInputTextFormField({ id, name, description, inline, h
|
|
|
187
187
|
"aria-valuemin"?: number | undefined;
|
|
188
188
|
"aria-valuenow"?: number | undefined;
|
|
189
189
|
"aria-valuetext"?: string | undefined;
|
|
190
|
-
children?:
|
|
190
|
+
children?: ReactNode | undefined;
|
|
191
191
|
dangerouslySetInnerHTML?: {
|
|
192
192
|
__html: string | TrustedHTML;
|
|
193
193
|
} | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ChangeEvent } from "react";
|
|
1
|
+
import { ChangeEvent, ReactNode } from "react";
|
|
2
2
|
export interface UseSelectFormFieldProps {
|
|
3
3
|
readonly id: string;
|
|
4
4
|
readonly name: string;
|
|
5
5
|
readonly disabled?: boolean;
|
|
6
6
|
readonly autofocus?: boolean;
|
|
7
|
-
readonly description?:
|
|
7
|
+
readonly description?: ReactNode;
|
|
8
8
|
readonly inline?: boolean;
|
|
9
9
|
readonly error?: string;
|
|
10
10
|
readonly invalid?: boolean;
|
package/dist/index.cjs
CHANGED
|
@@ -117,7 +117,6 @@ require('./useDebounce-cjs.js');
|
|
|
117
117
|
require('./debounce-cjs.js');
|
|
118
118
|
require('./isSymbol-cjs.js');
|
|
119
119
|
require('color');
|
|
120
|
-
require('./BannerIcon-cjs.js');
|
|
121
120
|
require('react-router-dom');
|
|
122
121
|
require('./getMappedAtlantisSpaceToken-cjs.js');
|
|
123
122
|
require('react-hook-form');
|
package/dist/index.mjs
CHANGED
|
@@ -115,7 +115,6 @@ import './useDebounce-es.js';
|
|
|
115
115
|
import './debounce-es.js';
|
|
116
116
|
import './isSymbol-es.js';
|
|
117
117
|
import 'color';
|
|
118
|
-
import './BannerIcon-es.js';
|
|
119
118
|
import 'react-router-dom';
|
|
120
119
|
import './getMappedAtlantisSpaceToken-es.js';
|
|
121
120
|
import 'react-hook-form';
|
package/dist/styles.css
CHANGED
|
@@ -1840,22 +1840,22 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
1840
1840
|
align-self: center;
|
|
1841
1841
|
}
|
|
1842
1842
|
|
|
1843
|
-
.
|
|
1843
|
+
.wc5os7zGk30- {
|
|
1844
1844
|
background-color: hsl(107, 58%, 33%);
|
|
1845
1845
|
background-color: var(--color-success);
|
|
1846
1846
|
}
|
|
1847
1847
|
|
|
1848
|
-
.
|
|
1848
|
+
.R0t3TbhBBqo- {
|
|
1849
1849
|
background-color: hsl(6, 64%, 51%);
|
|
1850
1850
|
background-color: var(--color-destructive);
|
|
1851
1851
|
}
|
|
1852
1852
|
|
|
1853
|
-
.
|
|
1853
|
+
.i5fVmbzbYVM- {
|
|
1854
1854
|
background-color: hsl(51, 64%, 49%);
|
|
1855
1855
|
background-color: var(--color-warning);
|
|
1856
1856
|
}
|
|
1857
1857
|
|
|
1858
|
-
.
|
|
1858
|
+
.onwyp3UI3so- {
|
|
1859
1859
|
background-color: hsl(207, 79%, 57%);
|
|
1860
1860
|
background-color: var(--color-informative);
|
|
1861
1861
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.73.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -542,5 +542,5 @@
|
|
|
542
542
|
"> 1%",
|
|
543
543
|
"IE 10"
|
|
544
544
|
],
|
|
545
|
-
"gitHead": "
|
|
545
|
+
"gitHead": "7f8481c4a6dbde1cd25aa16cf06e763aea00d9c8"
|
|
546
546
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { IconNames } from "@jobber/design";
|
|
3
|
-
import { BannerType } from "../../Banner.types";
|
|
4
|
-
export interface BannerIconProps {
|
|
5
|
-
readonly icon: IconNames;
|
|
6
|
-
readonly type: BannerType;
|
|
7
|
-
}
|
|
8
|
-
export declare function BannerIcon({ icon, type }: BannerIconProps): React.JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./BannerIcon";
|
package/dist/BannerIcon-cjs.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var classnames = require('classnames');
|
|
5
|
-
var Icon = require('./Icon-cjs.js');
|
|
6
|
-
|
|
7
|
-
var styles = {"banner":"ucGelS5nNm0-","notice":"_5VzH3Cz9ps8-","error":"_16jyB9OYJIs-","warning":"_4h-6cc8lZo8-","success":"k7T2IV0R8Q0-","bannerChildren":"dG2vHE6g8f0-","bannerContent":"j9IeihCCYxI-","medium":"D5X29shmSr0-","bannerAction":"W0pSTO-oRmk-","closeButton":"-IYYDBmq2Q0-","iconWrapper":"BQhacg0OlMs-","spinning":"fZdByimVT5Q-"};
|
|
8
|
-
|
|
9
|
-
var iconStyles = {"success":"RRQ5CQj05jU-","error":"rLsOR1QiHC8-","warning":"KqPf0zuN2fg-","notice":"M3q29PUUYRM-","spinning":"ad7f3jNTQXM-"};
|
|
10
|
-
|
|
11
|
-
function BannerIcon({ icon, type }) {
|
|
12
|
-
return (React.createElement("span", { className: classnames(styles.iconWrapper, iconStyles[type]) },
|
|
13
|
-
React.createElement(Icon.Icon, { name: icon, color: "surface", size: "small" })));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
exports.BannerIcon = BannerIcon;
|
|
17
|
-
exports.styles = styles;
|
package/dist/BannerIcon-es.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import classnames from 'classnames';
|
|
3
|
-
import { I as Icon } from './Icon-es.js';
|
|
4
|
-
|
|
5
|
-
var styles = {"banner":"ucGelS5nNm0-","notice":"_5VzH3Cz9ps8-","error":"_16jyB9OYJIs-","warning":"_4h-6cc8lZo8-","success":"k7T2IV0R8Q0-","bannerChildren":"dG2vHE6g8f0-","bannerContent":"j9IeihCCYxI-","medium":"D5X29shmSr0-","bannerAction":"W0pSTO-oRmk-","closeButton":"-IYYDBmq2Q0-","iconWrapper":"BQhacg0OlMs-","spinning":"fZdByimVT5Q-"};
|
|
6
|
-
|
|
7
|
-
var iconStyles = {"success":"RRQ5CQj05jU-","error":"rLsOR1QiHC8-","warning":"KqPf0zuN2fg-","notice":"M3q29PUUYRM-","spinning":"ad7f3jNTQXM-"};
|
|
8
|
-
|
|
9
|
-
function BannerIcon({ icon, type }) {
|
|
10
|
-
return (React__default.createElement("span", { className: classnames(styles.iconWrapper, iconStyles[type]) },
|
|
11
|
-
React__default.createElement(Icon, { name: icon, color: "surface", size: "small" })));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { BannerIcon as B, styles as s };
|