@jobber/components 2.86.0 → 2.86.2
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/CHANGELOG.md +16 -0
- package/dist/Autocomplete/Autocomplete.d.ts +47 -47
- package/dist/Autocomplete/Menu.d.ts +9 -9
- package/dist/Autocomplete/Option.d.ts +15 -15
- package/dist/Autocomplete/index.d.ts +2 -2
- package/dist/Autocomplete/index.js +215 -211
- package/dist/Avatar/Avatar.d.ts +37 -37
- package/dist/Avatar/index.d.ts +1 -1
- package/dist/Avatar/index.js +7 -74
- package/dist/Avatar/utilities.d.ts +1 -1
- package/dist/Avatar-cfd04e86.js +82 -0
- package/dist/Banner/Banner.d.ts +19 -19
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.js +67 -65
- package/dist/Button/Button.d.ts +64 -64
- package/dist/Button/index.d.ts +1 -1
- package/dist/Button/index.js +9 -53
- package/dist/Button-5b2f1636.js +60 -0
- package/dist/ButtonDismiss/ButtonDismiss.d.ts +7 -7
- package/dist/ButtonDismiss/index.d.ts +1 -1
- package/dist/ButtonDismiss/index.js +10 -15
- package/dist/ButtonDismiss-4cde8f7c.js +15 -0
- package/dist/Card/Card.d.ts +31 -31
- package/dist/Card/CardClickable.d.ts +12 -12
- package/dist/Card/index.d.ts +1 -1
- package/dist/Card/index.js +7 -61
- package/dist/Card-368e01a3.js +68 -0
- package/dist/Checkbox/Checkbox.d.ts +52 -52
- package/dist/Checkbox/index.d.ts +1 -1
- package/dist/Checkbox/index.js +34 -32
- package/dist/Chips/Chip.d.ts +8 -8
- package/dist/Chips/ChipDismissible.d.ts +7 -7
- package/dist/Chips/ChipTypes.d.ts +59 -59
- package/dist/Chips/Chips.d.ts +2 -2
- package/dist/Chips/ChipsTypes.d.ts +82 -82
- package/dist/Chips/InternalChip.d.ts +2 -2
- package/dist/Chips/InternalChipAffix.d.ts +10 -10
- package/dist/Chips/InternalChipButton.d.ts +10 -10
- package/dist/Chips/InternalChipDismissible/InternalChipDismissible.d.ts +2 -2
- package/dist/Chips/InternalChipDismissible/InternalChipDismissibleInput.d.ts +2 -2
- package/dist/Chips/InternalChipDismissible/InternalChipDismissibleTypes.d.ts +13 -13
- package/dist/Chips/InternalChipDismissible/hooks/index.d.ts +5 -5
- package/dist/Chips/InternalChipDismissible/hooks/useInView.d.ts +5 -5
- package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissible.d.ts +15 -15
- package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissibleInput.d.ts +28 -28
- package/dist/Chips/InternalChipDismissible/hooks/useRepositionMenu.d.ts +16 -16
- package/dist/Chips/InternalChipDismissible/hooks/useScrollToActive.d.ts +2 -2
- package/dist/Chips/InternalChipDismissible/index.d.ts +1 -1
- package/dist/Chips/InternalChipMultiSelect.d.ts +4 -4
- package/dist/Chips/InternalChipSingleSelect.d.ts +4 -4
- package/dist/Chips/index.d.ts +3 -3
- package/dist/Chips/index.js +493 -491
- package/dist/Chips/utils/mdxUtils.d.ts +9 -9
- package/dist/ConfirmationModal/ConfirmationModal.d.ts +62 -62
- package/dist/ConfirmationModal/index.d.ts +1 -1
- package/dist/ConfirmationModal/index.js +20 -109
- package/dist/ConfirmationModal-b7ef110f.js +103 -0
- package/dist/Content/Content.d.ts +13 -13
- package/dist/Content/index.d.ts +1 -1
- package/dist/Content/index.js +5 -19
- package/dist/Content-18de5fbb.js +26 -0
- package/dist/Countdown/Countdown.d.ts +31 -31
- package/dist/Countdown/computeTimeUnit.d.ts +3 -3
- package/dist/Countdown/index.d.ts +1 -1
- package/dist/Countdown/index.js +63 -61
- package/dist/DataDump/DataDump.d.ts +20 -20
- package/dist/DataDump/index.d.ts +1 -1
- package/dist/DataDump/index.js +18 -17
- package/dist/DatePicker/DatePicker.d.ts +50 -50
- package/dist/DatePicker/DatePickerActivator.d.ts +12 -12
- package/dist/DatePicker/DatePickerCustomHeader.d.ts +2 -2
- package/dist/DatePicker/index.d.ts +1 -1
- package/dist/DatePicker/index.js +13 -97
- package/dist/DatePicker/useFocusOnSelectedDate.d.ts +5 -5
- package/dist/DatePicker-ad6f8630.js +103 -0
- package/dist/DescriptionList/DescriptionList.d.ts +10 -10
- package/dist/DescriptionList/index.d.ts +1 -1
- package/dist/DescriptionList/index.js +16 -15
- package/dist/Disclosure/Disclosure.d.ts +20 -20
- package/dist/Disclosure/index.d.ts +1 -1
- package/dist/Disclosure/index.js +32 -31
- package/dist/Divider/Divider.d.ts +16 -16
- package/dist/Divider/index.d.ts +1 -1
- package/dist/Divider/index.js +19 -17
- package/dist/Drawer/Drawer.d.ts +13 -13
- package/dist/Drawer/DrawerGrid.d.ts +6 -6
- package/dist/Drawer/index.d.ts +2 -2
- package/dist/Drawer/index.js +39 -37
- package/dist/Emphasis/Emphasis.d.ts +11 -11
- package/dist/Emphasis/index.d.ts +1 -1
- package/dist/Emphasis/index.js +7 -17
- package/dist/Emphasis-fd845639.js +21 -0
- package/dist/FeatureSwitch/FeatureSwitch.d.ts +51 -51
- package/dist/FeatureSwitch/index.d.ts +1 -1
- package/dist/FeatureSwitch/index.js +57 -55
- package/dist/Form/Form.d.ts +18 -18
- package/dist/Form/index.d.ts +1 -1
- package/dist/Form/index.js +58 -57
- package/dist/FormField/FormField.d.ts +2 -2
- package/dist/FormField/FormFieldAffix.d.ts +13 -13
- package/dist/FormField/FormFieldDescription.d.ts +6 -6
- package/dist/FormField/FormFieldPostFix.d.ts +5 -5
- package/dist/FormField/FormFieldTypes.d.ts +160 -160
- package/dist/FormField/FormFieldWrapper.d.ts +9 -9
- package/dist/FormField/index.d.ts +2 -2
- package/dist/FormField/index.js +15 -208
- package/dist/FormField-a92c7bac.js +213 -0
- package/dist/FormatDate/FormatDate.d.ts +12 -12
- package/dist/FormatDate/index.d.ts +1 -1
- package/dist/FormatDate/index.js +24 -23
- package/dist/FormatEmail/FormatEmail.d.ts +8 -8
- package/dist/FormatEmail/index.d.ts +1 -1
- package/dist/FormatEmail/index.js +12 -10
- package/dist/FormatFile/FormatFile.d.ts +30 -30
- package/dist/FormatFile/FormatFileDeleteButton.d.ts +6 -6
- package/dist/FormatFile/InternalThumbnail.d.ts +9 -9
- package/dist/FormatFile/index.d.ts +1 -1
- package/dist/FormatFile/index.js +21 -112
- package/dist/FormatFile-5391d4cf.js +112 -0
- package/dist/FormatRelativeDateTime/FormatRelativeDateTime.d.ts +11 -11
- package/dist/FormatRelativeDateTime/index.d.ts +1 -1
- package/dist/FormatRelativeDateTime/index.js +64 -63
- package/dist/FormatTime/FormatTime.d.ts +15 -15
- package/dist/FormatTime/index.d.ts +1 -1
- package/dist/FormatTime/index.js +28 -27
- package/dist/Gallery/Gallery.d.ts +2 -2
- package/dist/Gallery/GalleryTypes.d.ts +31 -31
- package/dist/Gallery/index.d.ts +1 -1
- package/dist/Gallery/index.js +82 -80
- package/dist/Heading/Heading.d.ts +14 -14
- package/dist/Heading/index.d.ts +1 -1
- package/dist/Heading/index.js +7 -53
- package/dist/Heading-56750113.js +57 -0
- package/dist/Icon/Icon.d.ts +22 -22
- package/dist/Icon/index.d.ts +1 -1
- package/dist/Icon/index.js +4 -35
- package/dist/Icon-d5ad1a6d.js +41 -0
- package/dist/InlineLabel/InlineLabel.d.ts +17 -17
- package/dist/InlineLabel/index.d.ts +1 -1
- package/dist/InlineLabel/index.js +20 -18
- package/dist/InputAvatar/InputAvatar.d.ts +22 -22
- package/dist/InputAvatar/index.d.ts +1 -1
- package/dist/InputAvatar/index.js +57 -56
- package/dist/InputDate/InputDate.d.ts +19 -19
- package/dist/InputDate/index.d.ts +1 -1
- package/dist/InputDate/index.js +34 -33
- package/dist/InputEmail/InputEmail.d.ts +5 -5
- package/dist/InputEmail/index.d.ts +1 -1
- package/dist/InputEmail/index.js +29 -28
- package/dist/InputFile/InputFile.d.ts +121 -121
- package/dist/InputFile/index.d.ts +1 -1
- package/dist/InputFile/index.js +15 -168
- package/dist/InputFile-b5cf90c3.js +174 -0
- package/dist/InputGroup/InputGroup.d.ts +11 -11
- package/dist/InputGroup/index.d.ts +1 -1
- package/dist/InputGroup/index.js +24 -22
- package/dist/InputNumber/InputNumber.d.ts +11 -11
- package/dist/InputNumber/index.d.ts +1 -1
- package/dist/InputNumber/index.js +52 -51
- package/dist/InputPassword/InputPassword.d.ts +12 -12
- package/dist/InputPassword/index.d.ts +1 -1
- package/dist/InputPassword/index.js +28 -27
- package/dist/InputText/InputText.d.ts +29 -29
- package/dist/InputText/index.d.ts +1 -1
- package/dist/InputText/index.js +15 -95
- package/dist/InputText-cb3be15c.js +91 -0
- package/dist/InputTime/InputTime.d.ts +2 -2
- package/dist/InputTime/InputTimeProps.d.ts +18 -18
- package/dist/InputTime/InputTimeSafari.d.ts +2 -2
- package/dist/InputTime/civilTimeConversions.d.ts +3 -3
- package/dist/InputTime/index.d.ts +1 -1
- package/dist/InputTime/index.js +402 -257
- package/dist/InputValidation/InputValidation.d.ts +8 -8
- package/dist/InputValidation/index.d.ts +1 -1
- package/dist/InputValidation/index.js +8 -24
- package/dist/InputValidation-24d3621a.js +28 -0
- package/dist/LightBox/LightBox.d.ts +37 -37
- package/dist/LightBox/index.d.ts +1 -1
- package/dist/LightBox/index.js +6 -34
- package/dist/LightBox-b893b656.js +42 -0
- package/dist/List/List.d.ts +11 -11
- package/dist/List/ListItem.d.ts +54 -54
- package/dist/List/index.d.ts +1 -1
- package/dist/List/index.js +76 -74
- package/dist/Markdown/Markdown.d.ts +17 -17
- package/dist/Markdown/index.d.ts +1 -1
- package/dist/Markdown/index.js +12 -64
- package/dist/Markdown-69986c49.js +68 -0
- package/dist/Menu/Menu.d.ts +46 -46
- package/dist/Menu/index.d.ts +1 -1
- package/dist/Menu/index.js +13 -128
- package/dist/Menu-6a392af6.js +134 -0
- package/dist/Modal/Modal.d.ts +22 -22
- package/dist/Modal/index.d.ts +1 -1
- package/dist/Modal/index.js +14 -127
- package/dist/Modal/useFocusTrap.d.ts +10 -10
- package/dist/Modal-aaaaf2df.js +132 -0
- package/dist/Page/Page.d.ts +59 -59
- package/dist/Page/index.d.ts +1 -1
- package/dist/Page/index.js +63 -61
- package/dist/Popover/Popover.d.ts +26 -26
- package/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.js +49 -48
- package/dist/ProgressBar/ProgressBar.d.ts +18 -18
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/ProgressBar/index.js +5 -22
- package/dist/ProgressBar-e9a49129.js +29 -0
- package/dist/RadioGroup/RadioGroup.d.ts +27 -27
- package/dist/RadioGroup/RadioOption.d.ts +34 -34
- package/dist/RadioGroup/index.d.ts +2 -2
- package/dist/RadioGroup/index.js +38 -37
- package/dist/RecurringSelect/CurrentRecurrenceComponent.d.ts +8 -8
- package/dist/RecurringSelect/RecurringSelect.d.ts +8 -8
- package/dist/RecurringSelect/components/DayOfMonthSelect.d.ts +8 -8
- package/dist/RecurringSelect/components/MonthlyDayOfWeekSelect.d.ts +8 -8
- package/dist/RecurringSelect/components/MonthlySelect.d.ts +8 -8
- package/dist/RecurringSelect/components/WeeklySelect.d.ts +8 -8
- package/dist/RecurringSelect/components/index.d.ts +4 -4
- package/dist/RecurringSelect/index.d.ts +2 -2
- package/dist/RecurringSelect/types.d.ts +65 -65
- package/dist/Select/Option.d.ts +17 -17
- package/dist/Select/Select.d.ts +10 -10
- package/dist/Select/index.d.ts +2 -2
- package/dist/Select/index.js +20 -19
- package/dist/Spinner/Spinner.d.ts +15 -15
- package/dist/Spinner/index.d.ts +1 -1
- package/dist/Spinner/index.js +5 -19
- package/dist/Spinner-18d3dee6.js +26 -0
- package/dist/StatusLabel/StatusLabel.d.ts +25 -25
- package/dist/StatusLabel/index.d.ts +1 -1
- package/dist/StatusLabel/index.js +21 -19
- package/dist/Switch/Switch.d.ts +14 -14
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +7 -53
- package/dist/Switch-d2bec677.js +60 -0
- package/dist/Table/Body.d.ts +6 -6
- package/dist/Table/Cells/Cell.d.ts +7 -7
- package/dist/Table/Cells/CellCurrency.d.ts +8 -8
- package/dist/Table/Cells/CellNumeric.d.ts +4 -4
- package/dist/Table/Footer.d.ts +6 -6
- package/dist/Table/Header.d.ts +6 -6
- package/dist/Table/Row.d.ts +6 -6
- package/dist/Table/Table.d.ts +6 -6
- package/dist/Table/index.d.ts +8 -8
- package/dist/Table/index.js +41 -39
- package/dist/Tabs/Tabs.d.ts +19 -19
- package/dist/Tabs/index.d.ts +1 -1
- package/dist/Tabs/index.js +69 -67
- package/dist/Text/Text.d.ts +9 -9
- package/dist/Text/index.d.ts +1 -1
- package/dist/Text/index.js +7 -29
- package/dist/Text-9bc093e9.js +32 -0
- package/dist/Toast/Toast.d.ts +17 -17
- package/dist/Toast/index.d.ts +1 -1
- package/dist/Toast/index.js +93 -93
- package/dist/Toast/showToast.d.ts +2 -2
- package/dist/Tooltip/Tooltip.d.ts +10 -10
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.js +11 -110
- package/dist/Tooltip/useTooltipPositioning.d.ts +18 -18
- package/dist/Tooltip-4396164d.js +116 -0
- package/dist/Typography/Typography.d.ts +38 -38
- package/dist/Typography/index.d.ts +1 -1
- package/dist/Typography/index.js +6 -57
- package/dist/Typography-7e542a72.js +64 -0
- package/dist/{chunk-17e02351.js → style-inject.es-dcee06b6.js} +0 -0
- package/dist/{chunk-b67af3cb.js → tslib.es6-5b50eb8e.js} +0 -0
- package/package.json +6 -8
- package/rollup.config.js +28 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { TypographyOptions } from "../Typography";
|
|
3
|
-
interface EmphasisProps {
|
|
4
|
-
variation: "bold" | "italic" | "highlight";
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export interface VariationMap {
|
|
8
|
-
[variation: string]: TypographyOptions;
|
|
9
|
-
}
|
|
10
|
-
export declare function Emphasis({ variation, children }: EmphasisProps): JSX.Element;
|
|
11
|
-
export {};
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { TypographyOptions } from "../Typography";
|
|
3
|
+
interface EmphasisProps {
|
|
4
|
+
variation: "bold" | "italic" | "highlight";
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export interface VariationMap {
|
|
8
|
+
[variation: string]: TypographyOptions;
|
|
9
|
+
}
|
|
10
|
+
export declare function Emphasis({ variation, children }: EmphasisProps): JSX.Element;
|
|
11
|
+
export {};
|
package/dist/Emphasis/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Emphasis } from "./Emphasis";
|
|
1
|
+
export { Emphasis } from "./Emphasis";
|
package/dist/Emphasis/index.js
CHANGED
|
@@ -2,23 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var React__default = _interopDefault(React);
|
|
10
|
-
require('../chunk-17e02351.js');
|
|
5
|
+
var Emphasis = require('../Emphasis-fd845639.js');
|
|
6
|
+
require('../tslib.es6-5b50eb8e.js');
|
|
7
|
+
require('react');
|
|
8
|
+
require('../Typography-7e542a72.js');
|
|
11
9
|
require('classnames');
|
|
12
|
-
|
|
10
|
+
require('../style-inject.es-dcee06b6.js');
|
|
11
|
+
|
|
13
12
|
|
|
14
|
-
function Emphasis(_a) {
|
|
15
|
-
var variation = _a.variation, children = _a.children;
|
|
16
|
-
var variationMap = {
|
|
17
|
-
bold: { element: "b", fontWeight: "bold" },
|
|
18
|
-
italic: { element: "em", emphasisType: "italic" },
|
|
19
|
-
highlight: { element: "strong", emphasisType: "highlight" },
|
|
20
|
-
};
|
|
21
|
-
return React__default.createElement(index.Typography, __chunk_1.__assign({}, variationMap[variation]), children);
|
|
22
|
-
}
|
|
23
13
|
|
|
24
|
-
exports.Emphasis = Emphasis;
|
|
14
|
+
exports.Emphasis = Emphasis.Emphasis;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-5b50eb8e.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var Typography = require('./Typography-7e542a72.js');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
|
+
|
|
11
|
+
function Emphasis(_a) {
|
|
12
|
+
var variation = _a.variation, children = _a.children;
|
|
13
|
+
var variationMap = {
|
|
14
|
+
bold: { element: "b", fontWeight: "bold" },
|
|
15
|
+
italic: { element: "em", emphasisType: "italic" },
|
|
16
|
+
highlight: { element: "strong", emphasisType: "highlight" },
|
|
17
|
+
};
|
|
18
|
+
return React__default["default"].createElement(Typography.Typography, tslib_es6.__assign({}, variationMap[variation]), children);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.Emphasis = Emphasis;
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
interface FeatureSwitchProps {
|
|
3
|
-
readonly children?: ReactNode | ReactNode[];
|
|
4
|
-
/**
|
|
5
|
-
* Feature description. This supports basic markdown node types such as
|
|
6
|
-
* `_italic_`, `**bold**`, and `[link name](url)`
|
|
7
|
-
*/
|
|
8
|
-
readonly description?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Determines if the switch is disabled
|
|
11
|
-
*
|
|
12
|
-
* @default false
|
|
13
|
-
*/
|
|
14
|
-
readonly disabled?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Defines if the feature should be ON or OFF by default.
|
|
17
|
-
*
|
|
18
|
-
* @default false
|
|
19
|
-
*/
|
|
20
|
-
readonly enabled?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Defines if the links in the description should open in a new tab.
|
|
23
|
-
*
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
readonly externalLink?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Feature title.
|
|
29
|
-
*/
|
|
30
|
-
readonly title?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Determines if a save indicator should show up when the `enabled` prop
|
|
33
|
-
* changes. This means, it would only work for controlled components.
|
|
34
|
-
*
|
|
35
|
-
* @default false
|
|
36
|
-
*/
|
|
37
|
-
readonly hasSaveIndicator?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Callback when interacting with the switch.
|
|
40
|
-
*
|
|
41
|
-
* @param newValue
|
|
42
|
-
*/
|
|
43
|
-
onSwitch?(newValue: boolean): void;
|
|
44
|
-
/**
|
|
45
|
-
* Callback when clicking with the edit button. This also determines if the
|
|
46
|
-
* edit button should show up in the UI.
|
|
47
|
-
*/
|
|
48
|
-
onEdit?(): void;
|
|
49
|
-
}
|
|
50
|
-
export declare function FeatureSwitch({ children, description, disabled, enabled, externalLink, onEdit, onSwitch, hasSaveIndicator, title, }: FeatureSwitchProps): JSX.Element;
|
|
51
|
-
export {};
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
interface FeatureSwitchProps {
|
|
3
|
+
readonly children?: ReactNode | ReactNode[];
|
|
4
|
+
/**
|
|
5
|
+
* Feature description. This supports basic markdown node types such as
|
|
6
|
+
* `_italic_`, `**bold**`, and `[link name](url)`
|
|
7
|
+
*/
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Determines if the switch is disabled
|
|
11
|
+
*
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
readonly disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Defines if the feature should be ON or OFF by default.
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
readonly enabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Defines if the links in the description should open in a new tab.
|
|
23
|
+
*
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
readonly externalLink?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Feature title.
|
|
29
|
+
*/
|
|
30
|
+
readonly title?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Determines if a save indicator should show up when the `enabled` prop
|
|
33
|
+
* changes. This means, it would only work for controlled components.
|
|
34
|
+
*
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
readonly hasSaveIndicator?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Callback when interacting with the switch.
|
|
40
|
+
*
|
|
41
|
+
* @param newValue
|
|
42
|
+
*/
|
|
43
|
+
onSwitch?(newValue: boolean): void;
|
|
44
|
+
/**
|
|
45
|
+
* Callback when clicking with the edit button. This also determines if the
|
|
46
|
+
* edit button should show up in the UI.
|
|
47
|
+
*/
|
|
48
|
+
onEdit?(): void;
|
|
49
|
+
}
|
|
50
|
+
export declare function FeatureSwitch({ children, description, disabled, enabled, externalLink, onEdit, onSwitch, hasSaveIndicator, title, }: FeatureSwitchProps): JSX.Element;
|
|
51
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FeatureSwitch } from "./FeatureSwitch";
|
|
1
|
+
export { FeatureSwitch } from "./FeatureSwitch";
|
|
@@ -2,68 +2,70 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __chunk_1 = require('../chunk-b67af3cb.js');
|
|
5
|
+
var tslib_es6 = require('../tslib.es6-5b50eb8e.js');
|
|
8
6
|
var React = require('react');
|
|
9
|
-
var React__default = _interopDefault(React);
|
|
10
|
-
var __chunk_2 = require('../chunk-17e02351.js');
|
|
11
|
-
var classnames = _interopDefault(require('classnames'));
|
|
12
|
-
require('../Typography/index.js');
|
|
13
|
-
var index$1 = require('../Text/index.js');
|
|
14
|
-
require('@jobber/design');
|
|
15
|
-
require('../Icon/index.js');
|
|
16
|
-
var index$3 = require('../Heading/index.js');
|
|
17
|
-
require('react-router-dom');
|
|
18
|
-
var index$5 = require('../Button/index.js');
|
|
19
7
|
var framerMotion = require('framer-motion');
|
|
20
|
-
var
|
|
8
|
+
var classnames = require('classnames');
|
|
9
|
+
var styleInject_es = require('../style-inject.es-dcee06b6.js');
|
|
10
|
+
var Heading = require('../Heading-56750113.js');
|
|
11
|
+
var Text = require('../Text-9bc093e9.js');
|
|
12
|
+
var Content = require('../Content-18de5fbb.js');
|
|
13
|
+
var Switch = require('../Switch-d2bec677.js');
|
|
14
|
+
var Button = require('../Button-5b2f1636.js');
|
|
15
|
+
var Emphasis = require('../Emphasis-fd845639.js');
|
|
16
|
+
var Markdown = require('../Markdown-69986c49.js');
|
|
17
|
+
require('../Typography-7e542a72.js');
|
|
18
|
+
require('react-router-dom');
|
|
19
|
+
require('../Icon-d5ad1a6d.js');
|
|
20
|
+
require('@jobber/design');
|
|
21
21
|
require('react-markdown');
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
|
|
23
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
|
+
|
|
25
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
25
27
|
|
|
26
28
|
var css = "._2wLd_KRTNAGUWLuHUk3oW {\n display: -ms-flexbox;\n display: flex;\n}\n\n._3S4AEFcAzye_0NKuyb26Pt {\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n -ms-flex-item-align: center;\n align-self: center;\n padding-right: var(--space-base);\n transition: opacity var(--timing-base);\n}\n\n._3fTQ2YTOZjh3z63IpmHOEX {\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n -ms-flex-item-align: start;\n align-self: flex-start;\n position: relative;\n}\n\n.vVv_rOT7pURJPkU4rvJPE {\n position: absolute;\n top: 100%;\n width: 100%;\n margin-top: var(--space-smallest);\n text-align: center;\n}\n\n.f8zTHuP6EgBAklxGjSv1O {\n opacity: 0.5;\n}\n\n.NweVtD0555WFOwkVpskgX {\n opacity: 1;\n}\n";
|
|
27
29
|
var styles = {"container":"_2wLd_KRTNAGUWLuHUk3oW","content":"_3S4AEFcAzye_0NKuyb26Pt","action":"_3fTQ2YTOZjh3z63IpmHOEX","savedIndicator":"vVv_rOT7pURJPkU4rvJPE","featureContent":"f8zTHuP6EgBAklxGjSv1O","enabled":"NweVtD0555WFOwkVpskgX"};
|
|
28
|
-
|
|
30
|
+
styleInject_es.styleInject(css);
|
|
29
31
|
|
|
30
|
-
function FeatureSwitch(_a) {
|
|
31
|
-
var children = _a.children, description = _a.description, _b = _a.disabled, disabled = _b === void 0 ? false : _b, enabled = _a.enabled, _c = _a.externalLink, externalLink = _c === void 0 ? false : _c, onEdit = _a.onEdit, onSwitch = _a.onSwitch, _d = _a.hasSaveIndicator, hasSaveIndicator = _d === void 0 ? false : _d, title = _a.title;
|
|
32
|
-
var _e =
|
|
33
|
-
var featureContentClassnames =
|
|
34
|
-
shouldShowSavedIndicator();
|
|
35
|
-
return (React__default.createElement(
|
|
36
|
-
React__default.createElement("div", { className: styles.container },
|
|
37
|
-
React__default.createElement("div", { className: styles.content },
|
|
38
|
-
React__default.createElement(
|
|
39
|
-
title && React__default.createElement(
|
|
40
|
-
description && (React__default.createElement(
|
|
41
|
-
React__default.createElement(
|
|
42
|
-
onSwitch && (React__default.createElement("div", { className: styles.action },
|
|
43
|
-
React__default.createElement(
|
|
44
|
-
React__default.createElement(framerMotion.AnimatePresence, null, hasSaveIndicator && savedIndicator && (React__default.createElement(framerMotion.motion.div, { className: styles.savedIndicator, initial: { y: -4, opacity: 0 }, animate: { y: 0, opacity: 1 }, exit: { y: -4, opacity: 0 }, transition: {
|
|
45
|
-
delay: 0.2,
|
|
46
|
-
type: "spring",
|
|
47
|
-
damping: 20,
|
|
48
|
-
stiffness: 300,
|
|
49
|
-
}, onAnimationComplete: handleAnimationComplete },
|
|
50
|
-
React__default.createElement(
|
|
51
|
-
React__default.createElement(
|
|
52
|
-
(children || onEdit) && (React__default.createElement("div", { className: styles.container },
|
|
53
|
-
children && (React__default.createElement("div", { className: featureContentClassnames }, children)),
|
|
54
|
-
onEdit && (React__default.createElement("div", { className: styles.action },
|
|
55
|
-
React__default.createElement(
|
|
56
|
-
function shouldShowSavedIndicator() {
|
|
57
|
-
// Check if the component is mounted
|
|
58
|
-
var _a =
|
|
59
|
-
React.useEffect(function () { return setDidMount(true); }, []);
|
|
60
|
-
React.useEffect(function () {
|
|
61
|
-
didMount && hasSaveIndicator && setSavedIndicator(true);
|
|
62
|
-
}, [enabled]);
|
|
63
|
-
}
|
|
64
|
-
function handleAnimationComplete() {
|
|
65
|
-
setSavedIndicator(false);
|
|
66
|
-
}
|
|
32
|
+
function FeatureSwitch(_a) {
|
|
33
|
+
var children = _a.children, description = _a.description, _b = _a.disabled, disabled = _b === void 0 ? false : _b, enabled = _a.enabled, _c = _a.externalLink, externalLink = _c === void 0 ? false : _c, onEdit = _a.onEdit, onSwitch = _a.onSwitch, _d = _a.hasSaveIndicator, hasSaveIndicator = _d === void 0 ? false : _d, title = _a.title;
|
|
34
|
+
var _e = tslib_es6.__read(React.useState(false), 2), savedIndicator = _e[0], setSavedIndicator = _e[1];
|
|
35
|
+
var featureContentClassnames = classnames__default["default"](styles.featureContent, styles.content, enabled && styles.enabled);
|
|
36
|
+
shouldShowSavedIndicator();
|
|
37
|
+
return (React__default["default"].createElement(Content.Content, null,
|
|
38
|
+
React__default["default"].createElement("div", { className: styles.container },
|
|
39
|
+
React__default["default"].createElement("div", { className: styles.content },
|
|
40
|
+
React__default["default"].createElement(Content.Content, null,
|
|
41
|
+
title && React__default["default"].createElement(Heading.Heading, { level: 4 }, title),
|
|
42
|
+
description && (React__default["default"].createElement(Text.Text, null,
|
|
43
|
+
React__default["default"].createElement(Markdown.Markdown, { content: description, basicUsage: true, externalLink: externalLink }))))),
|
|
44
|
+
onSwitch && (React__default["default"].createElement("div", { className: styles.action },
|
|
45
|
+
React__default["default"].createElement(Switch.Switch, { value: enabled, onChange: onSwitch, ariaLabel: description, disabled: disabled }),
|
|
46
|
+
React__default["default"].createElement(framerMotion.AnimatePresence, null, hasSaveIndicator && savedIndicator && (React__default["default"].createElement(framerMotion.motion.div, { className: styles.savedIndicator, initial: { y: -4, opacity: 0 }, animate: { y: 0, opacity: 1 }, exit: { y: -4, opacity: 0 }, transition: {
|
|
47
|
+
delay: 0.2,
|
|
48
|
+
type: "spring",
|
|
49
|
+
damping: 20,
|
|
50
|
+
stiffness: 300,
|
|
51
|
+
}, onAnimationComplete: handleAnimationComplete },
|
|
52
|
+
React__default["default"].createElement(Text.Text, { variation: "success" },
|
|
53
|
+
React__default["default"].createElement(Emphasis.Emphasis, { variation: "italic" }, "Saved")))))))),
|
|
54
|
+
(children || onEdit) && (React__default["default"].createElement("div", { className: styles.container },
|
|
55
|
+
children && (React__default["default"].createElement("div", { className: featureContentClassnames }, children)),
|
|
56
|
+
onEdit && (React__default["default"].createElement("div", { className: styles.action },
|
|
57
|
+
React__default["default"].createElement(Button.Button, { label: "Edit", type: "tertiary", onClick: onEdit })))))));
|
|
58
|
+
function shouldShowSavedIndicator() {
|
|
59
|
+
// Check if the component is mounted
|
|
60
|
+
var _a = tslib_es6.__read(React.useState(false), 2), didMount = _a[0], setDidMount = _a[1];
|
|
61
|
+
React.useEffect(function () { return setDidMount(true); }, []);
|
|
62
|
+
React.useEffect(function () {
|
|
63
|
+
didMount && hasSaveIndicator && setSavedIndicator(true);
|
|
64
|
+
}, [enabled]);
|
|
65
|
+
}
|
|
66
|
+
function handleAnimationComplete() {
|
|
67
|
+
setSavedIndicator(false);
|
|
68
|
+
}
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
exports.FeatureSwitch = FeatureSwitch;
|
package/dist/Form/Form.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
2
|
-
export interface FormRef {
|
|
3
|
-
submit(): void;
|
|
4
|
-
}
|
|
5
|
-
interface FormProps {
|
|
6
|
-
readonly children: ReactNode;
|
|
7
|
-
/**
|
|
8
|
-
* Callback for when the form has been sucessfully
|
|
9
|
-
* submitted.
|
|
10
|
-
*/
|
|
11
|
-
onSubmit?(): void;
|
|
12
|
-
onStateChange?(formState: {
|
|
13
|
-
isDirty: boolean;
|
|
14
|
-
isValid: boolean;
|
|
15
|
-
}): void;
|
|
16
|
-
}
|
|
17
|
-
export declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<FormRef>>;
|
|
18
|
-
export {};
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
export interface FormRef {
|
|
3
|
+
submit(): void;
|
|
4
|
+
}
|
|
5
|
+
interface FormProps {
|
|
6
|
+
readonly children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Callback for when the form has been sucessfully
|
|
9
|
+
* submitted.
|
|
10
|
+
*/
|
|
11
|
+
onSubmit?(): void;
|
|
12
|
+
onStateChange?(formState: {
|
|
13
|
+
isDirty: boolean;
|
|
14
|
+
isValid: boolean;
|
|
15
|
+
}): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<FormRef>>;
|
|
18
|
+
export {};
|
package/dist/Form/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Form, FormRef } from "./Form";
|
|
1
|
+
export { Form, FormRef } from "./Form";
|
package/dist/Form/index.js
CHANGED
|
@@ -2,66 +2,67 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __chunk_1 = require('../chunk-b67af3cb.js');
|
|
5
|
+
var tslib_es6 = require('../tslib.es6-5b50eb8e.js');
|
|
8
6
|
var React = require('react');
|
|
9
|
-
var React__default = _interopDefault(React);
|
|
10
7
|
var reactHookForm = require('react-hook-form');
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
|
+
|
|
13
|
+
var Form = React.forwardRef(function InternalForm(_a, ref) {
|
|
14
|
+
var _this = this;
|
|
15
|
+
var onSubmit = _a.onSubmit, children = _a.children, onStateChange = _a.onStateChange;
|
|
16
|
+
var methods = reactHookForm.useForm({ mode: "onTouched" });
|
|
17
|
+
var errors = methods.errors, trigger = methods.trigger, handleSubmit = methods.handleSubmit, _b = methods.formState, isDirty = _b.isDirty, isValid = _b.isValid;
|
|
18
|
+
React.useEffect(function () { return onStateChange && onStateChange({ isDirty: isDirty, isValid: isValid }); }, [isDirty, isValid]);
|
|
19
|
+
React.useImperativeHandle(ref, function () { return ({
|
|
20
|
+
/**
|
|
21
|
+
* The `trigger()` method can also accept an array
|
|
22
|
+
* of fields to validate. We may at some point want
|
|
23
|
+
* to consider adding a `validate()` method to the
|
|
24
|
+
* `Form` component.
|
|
25
|
+
*/
|
|
26
|
+
submit: function () { return tslib_es6.__awaiter(_this, void 0, void 0, function () {
|
|
27
|
+
var valid;
|
|
28
|
+
return tslib_es6.__generator(this, function (_a) {
|
|
29
|
+
switch (_a.label) {
|
|
30
|
+
case 0: return [4 /*yield*/, trigger()];
|
|
31
|
+
case 1:
|
|
32
|
+
valid = _a.sent();
|
|
33
|
+
if (valid) {
|
|
34
|
+
submitHandler();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
trigger();
|
|
38
|
+
errorHandler(errors);
|
|
39
|
+
}
|
|
40
|
+
return [2 /*return*/];
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}); },
|
|
44
|
+
}); });
|
|
45
|
+
/**
|
|
46
|
+
* If an onSubmit is not passed into a form, it will only be used
|
|
47
|
+
* for validation. For that, we do not need to wrap it in a <form>
|
|
48
|
+
* tag. This allows the <Form> component to be used in legacy code.
|
|
49
|
+
*/
|
|
50
|
+
var Wrapper = onSubmit ? "form" : "div";
|
|
51
|
+
var formProps = {
|
|
52
|
+
onSubmit: onSubmit && handleSubmit(submitHandler, errorHandler),
|
|
53
|
+
};
|
|
54
|
+
return (React__default["default"].createElement(reactHookForm.FormProvider, tslib_es6.__assign({}, methods),
|
|
55
|
+
React__default["default"].createElement(Wrapper, tslib_es6.__assign({}, formProps, { "data-testid": "atlantis-form" }), children)));
|
|
56
|
+
function submitHandler() {
|
|
57
|
+
onSubmit && onSubmit();
|
|
58
|
+
}
|
|
59
|
+
function errorHandler(errs) {
|
|
60
|
+
var firstErrName = Object.keys(errs)[0];
|
|
61
|
+
var element = document.querySelector("[name=\"" + firstErrName + "\"]");
|
|
62
|
+
if (typeof element != undefined) {
|
|
63
|
+
element === null || element === void 0 ? void 0 : element.focus();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
65
66
|
});
|
|
66
67
|
|
|
67
68
|
exports.Form = Form;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FormFieldProps } from "./FormFieldTypes";
|
|
2
|
-
export declare function FormField(props: FormFieldProps): JSX.Element;
|
|
1
|
+
import { FormFieldProps } from "./FormFieldTypes";
|
|
2
|
+
export declare function FormField(props: FormFieldProps): JSX.Element;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { RefObject } from "react";
|
|
2
|
-
import { XOR } from "ts-xor";
|
|
3
|
-
import { Affix, FormFieldProps, Suffix } from "./FormFieldTypes";
|
|
4
|
-
interface AffixLabelProps extends Affix {
|
|
5
|
-
labelRef: RefObject<HTMLDivElement>;
|
|
6
|
-
variation?: "prefix" | "suffix";
|
|
7
|
-
}
|
|
8
|
-
export declare function AffixLabel({ label, variation, labelRef, }: AffixLabelProps): JSX.Element;
|
|
9
|
-
interface AffixIconProps extends Pick<FormFieldProps, "size"> {
|
|
10
|
-
readonly variation?: "prefix" | "suffix";
|
|
11
|
-
}
|
|
12
|
-
export declare function AffixIcon({ icon, onClick, ariaLabel, variation, size, }: AffixIconProps & XOR<Affix, Suffix>): JSX.Element;
|
|
13
|
-
export {};
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import { XOR } from "ts-xor";
|
|
3
|
+
import { Affix, FormFieldProps, Suffix } from "./FormFieldTypes";
|
|
4
|
+
interface AffixLabelProps extends Affix {
|
|
5
|
+
labelRef: RefObject<HTMLDivElement>;
|
|
6
|
+
variation?: "prefix" | "suffix";
|
|
7
|
+
}
|
|
8
|
+
export declare function AffixLabel({ label, variation, labelRef, }: AffixLabelProps): JSX.Element;
|
|
9
|
+
interface AffixIconProps extends Pick<FormFieldProps, "size"> {
|
|
10
|
+
readonly variation?: "prefix" | "suffix";
|
|
11
|
+
}
|
|
12
|
+
export declare function AffixIcon({ icon, onClick, ariaLabel, variation, size, }: AffixIconProps & XOR<Affix, Suffix>): JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
interface FormFieldDescriptionProps {
|
|
2
|
-
readonly id: string;
|
|
3
|
-
readonly description: string;
|
|
4
|
-
}
|
|
5
|
-
export declare function FormFieldDescription({ id, description, }: FormFieldDescriptionProps): JSX.Element;
|
|
6
|
-
export {};
|
|
1
|
+
interface FormFieldDescriptionProps {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly description: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function FormFieldDescription({ id, description, }: FormFieldDescriptionProps): JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
interface FormFieldPostFixProps {
|
|
2
|
-
readonly variation: "select" | "spinner";
|
|
3
|
-
}
|
|
4
|
-
export declare function FormFieldPostFix({ variation }: FormFieldPostFixProps): JSX.Element;
|
|
5
|
-
export {};
|
|
1
|
+
interface FormFieldPostFixProps {
|
|
2
|
+
readonly variation: "select" | "spinner";
|
|
3
|
+
}
|
|
4
|
+
export declare function FormFieldPostFix({ variation }: FormFieldPostFixProps): JSX.Element;
|
|
5
|
+
export {};
|