@jobber/components 8.13.1-addeditor-cab44cf.0 → 8.14.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/Checkbox/Checkbox.d.ts +1 -1
- package/dist/DataList/components/DataListHeader/index.cjs +0 -1
- package/dist/DataList/components/DataListHeader/index.mjs +0 -1
- package/dist/DataList/components/DataListSearch/index.cjs +1 -2
- package/dist/DataList/components/DataListSearch/index.mjs +1 -2
- package/dist/DataList/index.cjs +0 -1
- package/dist/DataList/index.mjs +0 -1
- package/dist/DataListHeader-cjs.js +22 -5
- package/dist/DataListHeader-es.js +22 -5
- package/dist/DataListSearch-cjs.js +19 -2
- package/dist/DataListSearch-es.js +19 -2
- package/dist/docs/Banner/Banner.md +2 -2
- package/dist/docs/Box/Box.md +2 -2
- package/dist/docs/Card/Card.md +1 -1
- package/dist/docs/Icon/Icon.md +2 -1
- package/dist/docs/Menu/Menu.md +1 -1
- package/dist/docs/index.md +0 -1
- package/dist/index.cjs +1 -3
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +1 -2
- package/dist/utils/meta/meta.json +0 -2
- package/package.json +3 -8
- package/AnimatedSwitcher.d.ts +0 -1
- package/AnimatedSwitcher.js +0 -17
- package/dist/AnimatedSwitcher/AnimatedSwitcher.d.ts +0 -32
- package/dist/AnimatedSwitcher/index.cjs +0 -11
- package/dist/AnimatedSwitcher/index.d.ts +0 -1
- package/dist/AnimatedSwitcher/index.mjs +0 -5
- package/dist/AnimatedSwitcher/transitions.d.ts +0 -8
- package/dist/AnimatedSwitcher-cjs.js +0 -95
- package/dist/AnimatedSwitcher-es.js +0 -93
- package/dist/docs/AnimatedSwitcher/AnimatedSwitcher.md +0 -34
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const Checkbox: React.ForwardRefExoticComponent<import("./Checkbox.types").CheckboxCoreProps & import("../sharedHelpers/types").AriaInputProps & import("../sharedHelpers/types").FocusEvents<HTMLInputElement> & import("../sharedHelpers/types").MouseEvents<HTMLInputElement> & Pick<import("../sharedHelpers/types").HTMLInputBaseProps, "
|
|
2
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<import("./Checkbox.types").CheckboxCoreProps & import("../sharedHelpers/types").AriaInputProps & import("../sharedHelpers/types").FocusEvents<HTMLInputElement> & import("../sharedHelpers/types").MouseEvents<HTMLInputElement> & Pick<import("../sharedHelpers/types").HTMLInputBaseProps, "disabled" | "name" | "id"> & {
|
|
3
3
|
label?: string | React.ReactElement;
|
|
4
4
|
description?: React.ReactNode;
|
|
5
5
|
invalid?: boolean;
|
|
@@ -22,7 +22,6 @@ require('../../../DataListSortingOptions-cjs.js');
|
|
|
22
22
|
require('../../../Icon-cjs.js');
|
|
23
23
|
require('../../../Heading-cjs.js');
|
|
24
24
|
require('../../../useResponsiveSizing-cjs.js');
|
|
25
|
-
require('../../../AnimatedSwitcher-cjs.js');
|
|
26
25
|
require('framer-motion');
|
|
27
26
|
require('../../../Button-cjs.js');
|
|
28
27
|
require('../../../tslib.es6-cjs.js');
|
|
@@ -20,7 +20,6 @@ import '../../../DataListSortingOptions-es.js';
|
|
|
20
20
|
import '../../../Icon-es.js';
|
|
21
21
|
import '../../../Heading-es.js';
|
|
22
22
|
import '../../../useResponsiveSizing-es.js';
|
|
23
|
-
import '../../../AnimatedSwitcher-es.js';
|
|
24
23
|
import 'framer-motion';
|
|
25
24
|
import '../../../Button-es.js';
|
|
26
25
|
import '../../../tslib.es6-es.js';
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
var DataListSearch = require('../../../DataListSearch-cjs.js');
|
|
4
4
|
require('react');
|
|
5
5
|
require('classnames');
|
|
6
|
+
require('framer-motion');
|
|
6
7
|
require('@jobber/design');
|
|
7
8
|
require('@jobber/hooks');
|
|
8
9
|
require('../../../InputText-cjs.js');
|
|
9
10
|
require('../../../useAtlantisFormFieldName-cjs.js');
|
|
10
11
|
require('../../../FormFieldWrapper-cjs.js');
|
|
11
|
-
require('framer-motion');
|
|
12
12
|
require('../../../Button-cjs.js');
|
|
13
13
|
require('../../../tslib.es6-cjs.js');
|
|
14
14
|
require('react-router-dom');
|
|
@@ -25,7 +25,6 @@ require('../../../DataListContext-cjs.js');
|
|
|
25
25
|
require('../../../noop-cjs.js');
|
|
26
26
|
require('../../../_commonjsHelpers-cjs.js');
|
|
27
27
|
require('../../../DataList.const-cjs.js');
|
|
28
|
-
require('../../../AnimatedSwitcher-cjs.js');
|
|
29
28
|
|
|
30
29
|
|
|
31
30
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { D as DATA_LIST_SEARCH_TEST_ID, a as DataListSearch, I as InternalDataListSearch } from '../../../DataListSearch-es.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import 'classnames';
|
|
4
|
+
import 'framer-motion';
|
|
4
5
|
import '@jobber/design';
|
|
5
6
|
import '@jobber/hooks';
|
|
6
7
|
import '../../../InputText-es.js';
|
|
7
8
|
import '../../../useAtlantisFormFieldName-es.js';
|
|
8
9
|
import '../../../FormFieldWrapper-es.js';
|
|
9
|
-
import 'framer-motion';
|
|
10
10
|
import '../../../Button-es.js';
|
|
11
11
|
import '../../../tslib.es6-es.js';
|
|
12
12
|
import 'react-router-dom';
|
|
@@ -23,4 +23,3 @@ import '../../../DataListContext-es.js';
|
|
|
23
23
|
import '../../../noop-es.js';
|
|
24
24
|
import '../../../_commonjsHelpers-es.js';
|
|
25
25
|
import '../../../DataList.const-es.js';
|
|
26
|
-
import '../../../AnimatedSwitcher-es.js';
|
package/dist/DataList/index.cjs
CHANGED
|
@@ -53,7 +53,6 @@ require('../filterDataAttributes-cjs.js');
|
|
|
53
53
|
require('../useBatchSelect-cjs.js');
|
|
54
54
|
require('../DataListItemClickable-cjs.js');
|
|
55
55
|
require('../DataListHeader-cjs.js');
|
|
56
|
-
require('../AnimatedSwitcher-cjs.js');
|
|
57
56
|
require('../DataListBulkActions-cjs.js');
|
|
58
57
|
require('../DataListFilters-cjs.js');
|
|
59
58
|
require('../DataListSort-cjs.js');
|
package/dist/DataList/index.mjs
CHANGED
|
@@ -51,7 +51,6 @@ import '../filterDataAttributes-es.js';
|
|
|
51
51
|
import '../useBatchSelect-es.js';
|
|
52
52
|
import '../DataListItemClickable-es.js';
|
|
53
53
|
import '../DataListHeader-es.js';
|
|
54
|
-
import '../AnimatedSwitcher-es.js';
|
|
55
54
|
import '../DataListBulkActions-es.js';
|
|
56
55
|
import '../DataListFilters-es.js';
|
|
57
56
|
import '../DataListSort-es.js';
|
|
@@ -5,7 +5,7 @@ var DataListContext = require('./DataListContext-cjs.js');
|
|
|
5
5
|
var DataList_utils = require('./DataList.utils-cjs.js');
|
|
6
6
|
var useResponsiveSizing = require('./useResponsiveSizing-cjs.js');
|
|
7
7
|
var classnames = require('classnames');
|
|
8
|
-
var
|
|
8
|
+
var framerMotion = require('framer-motion');
|
|
9
9
|
var Text = require('./Text-cjs.js');
|
|
10
10
|
var Button = require('./Button-cjs.js');
|
|
11
11
|
var Checkbox = require('./Checkbox-cjs.js');
|
|
@@ -14,6 +14,22 @@ var DataListBulkActions = require('./DataListBulkActions-cjs.js');
|
|
|
14
14
|
var useBatchSelect = require('./useBatchSelect-cjs.js');
|
|
15
15
|
var useActiveLayout = require('./useActiveLayout-cjs.js');
|
|
16
16
|
|
|
17
|
+
const SWAP_DURATION = 0.1;
|
|
18
|
+
const SLIDE_IN_DOWN = {
|
|
19
|
+
visible: { y: 0, opacity: 1 },
|
|
20
|
+
hidden: { y: "-10%", opacity: 0 },
|
|
21
|
+
};
|
|
22
|
+
const SLIDE_IN_UP = {
|
|
23
|
+
visible: { y: 0, opacity: 1 },
|
|
24
|
+
hidden: { y: "10%", opacity: 0 },
|
|
25
|
+
};
|
|
26
|
+
// Match the wrapper's display to its child so the animation wrapper does not
|
|
27
|
+
// shift surrounding inline layout.
|
|
28
|
+
function applyChildDisplay(node) {
|
|
29
|
+
if (node === null || node === void 0 ? void 0 : node.firstElementChild) {
|
|
30
|
+
node.style.display = window.getComputedStyle(node.firstElementChild).display;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
17
33
|
const DATA_LIST_HEADER_CHECKBOX_TEST_ID = "ATL-DataList-header-checkbox";
|
|
18
34
|
const DATA_LIST_HEADER_BATCH_SELECT_TEST_ID = "ATL-DataList-header-batch-select";
|
|
19
35
|
function DataListHeaderCheckbox({ children }) {
|
|
@@ -67,13 +83,14 @@ function DataListHeaderCheckbox({ children }) {
|
|
|
67
83
|
}
|
|
68
84
|
function ColumnHeaderContent({ canSelectAll, children, hasAtLeastOneSelected, selectedCount, deselectText, onSelect, }) {
|
|
69
85
|
if (canSelectAll) {
|
|
70
|
-
return (React.createElement(
|
|
86
|
+
return (React.createElement(framerMotion.AnimatePresence, { mode: "wait", initial: false },
|
|
87
|
+
React.createElement(framerMotion.motion.div, { ref: applyChildDisplay, key: hasAtLeastOneSelected ? "batch-select" : "header", variants: hasAtLeastOneSelected ? SLIDE_IN_UP : SLIDE_IN_DOWN, initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: SWAP_DURATION } }, hasAtLeastOneSelected ? (React.createElement("div", { "data-testid": DATA_LIST_HEADER_BATCH_SELECT_TEST_ID, className: DataList_module.styles.batchSelectContainer },
|
|
71
88
|
React.createElement("div", { className: DataList_module.styles.headerBatchSelect },
|
|
72
|
-
Boolean(selectedCount) && React.createElement(Text.Text, null,
|
|
89
|
+
Boolean(selectedCount) && (React.createElement(Text.Text, null,
|
|
73
90
|
selectedCount,
|
|
74
|
-
" selected"),
|
|
91
|
+
" selected")),
|
|
75
92
|
React.createElement(Button.Button, { label: deselectText, onClick: () => onSelect === null || onSelect === void 0 ? void 0 : onSelect([]), type: "tertiary" })),
|
|
76
|
-
React.createElement(DataListBulkActions.InternalDataListBulkActions, null))
|
|
93
|
+
React.createElement(DataListBulkActions.InternalDataListBulkActions, null))) : (children))));
|
|
77
94
|
}
|
|
78
95
|
else {
|
|
79
96
|
return children;
|
|
@@ -3,7 +3,7 @@ import { u as useDataListContext } from './DataListContext-es.js';
|
|
|
3
3
|
import { c as generateHeaderElements, s as sortBreakpoints } from './DataList.utils-es.js';
|
|
4
4
|
import { u as useResponsiveSizing } from './useResponsiveSizing-es.js';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
-
import {
|
|
6
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
7
7
|
import { T as Text } from './Text-es.js';
|
|
8
8
|
import { B as Button } from './Button-es.js';
|
|
9
9
|
import { C as Checkbox } from './Checkbox-es.js';
|
|
@@ -12,6 +12,22 @@ import { I as InternalDataListBulkActions } from './DataListBulkActions-es.js';
|
|
|
12
12
|
import { u as useBatchSelect } from './useBatchSelect-es.js';
|
|
13
13
|
import { u as useActiveLayout } from './useActiveLayout-es.js';
|
|
14
14
|
|
|
15
|
+
const SWAP_DURATION = 0.1;
|
|
16
|
+
const SLIDE_IN_DOWN = {
|
|
17
|
+
visible: { y: 0, opacity: 1 },
|
|
18
|
+
hidden: { y: "-10%", opacity: 0 },
|
|
19
|
+
};
|
|
20
|
+
const SLIDE_IN_UP = {
|
|
21
|
+
visible: { y: 0, opacity: 1 },
|
|
22
|
+
hidden: { y: "10%", opacity: 0 },
|
|
23
|
+
};
|
|
24
|
+
// Match the wrapper's display to its child so the animation wrapper does not
|
|
25
|
+
// shift surrounding inline layout.
|
|
26
|
+
function applyChildDisplay(node) {
|
|
27
|
+
if (node === null || node === void 0 ? void 0 : node.firstElementChild) {
|
|
28
|
+
node.style.display = window.getComputedStyle(node.firstElementChild).display;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
15
31
|
const DATA_LIST_HEADER_CHECKBOX_TEST_ID = "ATL-DataList-header-checkbox";
|
|
16
32
|
const DATA_LIST_HEADER_BATCH_SELECT_TEST_ID = "ATL-DataList-header-batch-select";
|
|
17
33
|
function DataListHeaderCheckbox({ children }) {
|
|
@@ -65,13 +81,14 @@ function DataListHeaderCheckbox({ children }) {
|
|
|
65
81
|
}
|
|
66
82
|
function ColumnHeaderContent({ canSelectAll, children, hasAtLeastOneSelected, selectedCount, deselectText, onSelect, }) {
|
|
67
83
|
if (canSelectAll) {
|
|
68
|
-
return (React__default.createElement(
|
|
84
|
+
return (React__default.createElement(AnimatePresence, { mode: "wait", initial: false },
|
|
85
|
+
React__default.createElement(motion.div, { ref: applyChildDisplay, key: hasAtLeastOneSelected ? "batch-select" : "header", variants: hasAtLeastOneSelected ? SLIDE_IN_UP : SLIDE_IN_DOWN, initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: SWAP_DURATION } }, hasAtLeastOneSelected ? (React__default.createElement("div", { "data-testid": DATA_LIST_HEADER_BATCH_SELECT_TEST_ID, className: styles.batchSelectContainer },
|
|
69
86
|
React__default.createElement("div", { className: styles.headerBatchSelect },
|
|
70
|
-
Boolean(selectedCount) && React__default.createElement(Text, null,
|
|
87
|
+
Boolean(selectedCount) && (React__default.createElement(Text, null,
|
|
71
88
|
selectedCount,
|
|
72
|
-
" selected"),
|
|
89
|
+
" selected")),
|
|
73
90
|
React__default.createElement(Button, { label: deselectText, onClick: () => onSelect === null || onSelect === void 0 ? void 0 : onSelect([]), type: "tertiary" })),
|
|
74
|
-
React__default.createElement(InternalDataListBulkActions, null))
|
|
91
|
+
React__default.createElement(InternalDataListBulkActions, null))) : (children))));
|
|
75
92
|
}
|
|
76
93
|
else {
|
|
77
94
|
return children;
|
|
@@ -2,17 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var classnames = require('classnames');
|
|
5
|
+
var framerMotion = require('framer-motion');
|
|
5
6
|
var design = require('@jobber/design');
|
|
6
7
|
var jobberHooks = require('@jobber/hooks');
|
|
7
8
|
var InputText = require('./InputText-cjs.js');
|
|
8
9
|
var DataListContext = require('./DataListContext-cjs.js');
|
|
9
10
|
var DataList_const = require('./DataList.const-cjs.js');
|
|
10
11
|
var Button = require('./Button-cjs.js');
|
|
11
|
-
var AnimatedSwitcher = require('./AnimatedSwitcher-cjs.js');
|
|
12
12
|
|
|
13
13
|
var styles = {"wrapper":"S2Bu0Rv4w-E-","searchInput":"N8dyu-defmc-","searchInputVisible":"UhMQC1SZUns-","searchButton":"zQPIm20aF50-","withNoFilters":"oOqZupWkemo-","spinning":"Wq63M3dVuYs-"};
|
|
14
14
|
|
|
15
15
|
const DATA_LIST_SEARCH_TEST_ID = "ATL-DataList-Search-input-wrapper";
|
|
16
|
+
const SWAP_DURATION = 0.1;
|
|
17
|
+
const SLIDE_IN_DOWN = {
|
|
18
|
+
visible: { y: 0, opacity: 1 },
|
|
19
|
+
hidden: { y: "-10%", opacity: 0 },
|
|
20
|
+
};
|
|
21
|
+
const SLIDE_IN_UP = {
|
|
22
|
+
visible: { y: 0, opacity: 1 },
|
|
23
|
+
hidden: { y: "10%", opacity: 0 },
|
|
24
|
+
};
|
|
25
|
+
// Match the wrapper's display to its child so the animation wrapper does not
|
|
26
|
+
// shift surrounding inline layout.
|
|
27
|
+
function applyChildDisplay(node) {
|
|
28
|
+
if (node === null || node === void 0 ? void 0 : node.firstElementChild) {
|
|
29
|
+
node.style.display = window.getComputedStyle(node.firstElementChild).display;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
16
32
|
// This component is meant to capture the props of the DataList.Search
|
|
17
33
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18
34
|
function DataListSearch(_) {
|
|
@@ -45,7 +61,8 @@ function InternalDataListSearch() {
|
|
|
45
61
|
? (val) => searchComponent.props.onSearch(val)
|
|
46
62
|
: handleUncontrolledChange, prefix: { icon: "search" }, clearable: "always" })),
|
|
47
63
|
React.createElement("div", { className: styles.searchButton },
|
|
48
|
-
React.createElement(
|
|
64
|
+
React.createElement(framerMotion.AnimatePresence, { mode: "wait", initial: false },
|
|
65
|
+
React.createElement(framerMotion.motion.div, { ref: applyChildDisplay, key: visible ? "close" : "search", variants: visible ? SLIDE_IN_UP : SLIDE_IN_DOWN, initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: SWAP_DURATION } }, visible ? (React.createElement(Button.Button, { variation: "subtle", icon: "remove", ariaLabel: "Close search bar", onClick: toggleSearch })) : (React.createElement(Button.Button, { variation: "subtle", icon: "search", ariaLabel: "Search", onClick: toggleSearch })))))));
|
|
49
66
|
function getPlaceholder() {
|
|
50
67
|
if (placeholder)
|
|
51
68
|
return placeholder;
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import React__default, { useRef, useState } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
3
4
|
import { tokens } from '@jobber/design';
|
|
4
5
|
import { useDebounce } from '@jobber/hooks';
|
|
5
6
|
import { I as InputText } from './InputText-es.js';
|
|
6
7
|
import { u as useDataListContext } from './DataListContext-es.js';
|
|
7
8
|
import { S as SEARCH_DEBOUNCE_DELAY } from './DataList.const-es.js';
|
|
8
9
|
import { B as Button } from './Button-es.js';
|
|
9
|
-
import { A as AnimatedSwitcher } from './AnimatedSwitcher-es.js';
|
|
10
10
|
|
|
11
11
|
var styles = {"wrapper":"S2Bu0Rv4w-E-","searchInput":"N8dyu-defmc-","searchInputVisible":"UhMQC1SZUns-","searchButton":"zQPIm20aF50-","withNoFilters":"oOqZupWkemo-","spinning":"Wq63M3dVuYs-"};
|
|
12
12
|
|
|
13
13
|
const DATA_LIST_SEARCH_TEST_ID = "ATL-DataList-Search-input-wrapper";
|
|
14
|
+
const SWAP_DURATION = 0.1;
|
|
15
|
+
const SLIDE_IN_DOWN = {
|
|
16
|
+
visible: { y: 0, opacity: 1 },
|
|
17
|
+
hidden: { y: "-10%", opacity: 0 },
|
|
18
|
+
};
|
|
19
|
+
const SLIDE_IN_UP = {
|
|
20
|
+
visible: { y: 0, opacity: 1 },
|
|
21
|
+
hidden: { y: "10%", opacity: 0 },
|
|
22
|
+
};
|
|
23
|
+
// Match the wrapper's display to its child so the animation wrapper does not
|
|
24
|
+
// shift surrounding inline layout.
|
|
25
|
+
function applyChildDisplay(node) {
|
|
26
|
+
if (node === null || node === void 0 ? void 0 : node.firstElementChild) {
|
|
27
|
+
node.style.display = window.getComputedStyle(node.firstElementChild).display;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
14
30
|
// This component is meant to capture the props of the DataList.Search
|
|
15
31
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
32
|
function DataListSearch(_) {
|
|
@@ -43,7 +59,8 @@ function InternalDataListSearch() {
|
|
|
43
59
|
? (val) => searchComponent.props.onSearch(val)
|
|
44
60
|
: handleUncontrolledChange, prefix: { icon: "search" }, clearable: "always" })),
|
|
45
61
|
React__default.createElement("div", { className: styles.searchButton },
|
|
46
|
-
React__default.createElement(
|
|
62
|
+
React__default.createElement(AnimatePresence, { mode: "wait", initial: false },
|
|
63
|
+
React__default.createElement(motion.div, { ref: applyChildDisplay, key: visible ? "close" : "search", variants: visible ? SLIDE_IN_UP : SLIDE_IN_DOWN, initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: SWAP_DURATION } }, visible ? (React__default.createElement(Button, { variation: "subtle", icon: "remove", ariaLabel: "Close search bar", onClick: toggleSearch })) : (React__default.createElement(Button, { variation: "subtle", icon: "search", ariaLabel: "Search", onClick: toggleSearch })))))));
|
|
47
64
|
function getPlaceholder() {
|
|
48
65
|
if (placeholder)
|
|
49
66
|
return placeholder;
|
|
@@ -441,8 +441,8 @@ Use `UNSAFE_style` to apply inline custom styles to the Banner.
|
|
|
441
441
|
|
|
442
442
|
| Prop | Type | Required | Default | Description |
|
|
443
443
|
|------|------|----------|---------|-------------|
|
|
444
|
-
| `backgroundColor` | `"
|
|
445
|
-
| `color` | `"
|
|
444
|
+
| `backgroundColor` | `"disabled" | "icon" | "event" | "invoice" | "job" | "quote" | "request" | "task" | "text" | "visit" | "warning" | "success" | "base-grey--100" | "base-grey--200" | "base-grey--300" | ... 269 more ... | "client--onSurface"` | No | — | Sets the background color of the icon. |
|
|
445
|
+
| `color` | `"disabled" | "icon" | "task" | "text" | "warning" | "success" | "blue" | "green" | "yellow" | "red" | "grey" | "white" | "greyBlue" | "lightBlue" | "orange" | "navy" | "interactive" | ... 32 more ... | "brandHighlight"` | No | — | Determines the color of the icon. Some icons have a default system colour like quotes, jobs, and invoices. Others tha... |
|
|
446
446
|
| `customColor` | `string` | No | — | Sets a custom color for the icon. Can be a rgb() or hex value. |
|
|
447
447
|
| `name` | `IconNames` | No | — | The icon to show. |
|
|
448
448
|
| `size` | `"base" | "large" | "small"` | No | `base` | Changes the size to small or large. |
|
package/dist/docs/Box/Box.md
CHANGED
|
@@ -206,9 +206,9 @@ defaults to respecting theme/modes.
|
|
|
206
206
|
| `alignItems` | `AlignItems` | No | — | This feature is well established and works across many devices and browser versions. It’s been available across brows... |
|
|
207
207
|
| `alignSelf` | `AlignSelf` | No | — | This feature is well established and works across many devices and browser versions. It’s been available across brows... |
|
|
208
208
|
| `as` | `"article" | "aside" | "div" | "main" | "section" | "span"` | No | `div` | |
|
|
209
|
-
| `background` | `"
|
|
209
|
+
| `background` | `"disabled" | "icon" | "event" | "invoice" | "job" | "quote" | "request" | "task" | "text" | "visit" | "warning" | "success" | "base-grey--100" | "base-grey--200" | "base-grey--300" | ... 269 more ... | "client--onSurface"` | No | — | |
|
|
210
210
|
| `border` | `"base" | "thick" | "thicker" | "thickest" | BoxBorderWidth` | No | — | |
|
|
211
|
-
| `borderColor` | `"
|
|
211
|
+
| `borderColor` | `"disabled" | "icon" | "event" | "invoice" | "job" | "quote" | "request" | "task" | "text" | "visit" | "warning" | "success" | "base-grey--100" | "base-grey--200" | "base-grey--300" | ... 269 more ... | "client--onSurface"` | No | — | |
|
|
212
212
|
| `direction` | `FlexDirection` | No | — | |
|
|
213
213
|
| `gap` | `"base" | "extravagant" | "large" | "larger" | "largest" | "minuscule" | "slim" | "small" | "smaller" | "smallest"` | No | — | |
|
|
214
214
|
| `height` | `BoxDimension` | No | `auto` | |
|
package/dist/docs/Card/Card.md
CHANGED
|
@@ -265,7 +265,7 @@ desired markup and have no need for either UNSAFE.
|
|
|
265
265
|
| `accent` | `"indigo" | "teal" | "blue" | "green" | "lime" | "yellowGreen" | "yellow" | "red" | "grey" | "white" | "greyBlue" | "lightBlue" | "purple" | "pink" | "orange" | "brown" | "navy" | ... 68 more ... | "yellowLightest"` | No | — | The `accent`, if provided, will effect the color accent at the top of the card. |
|
|
266
266
|
| `elevation` | `elevationProp` | No | — | |
|
|
267
267
|
| `external` | `boolean` | No | — | Makes the URL open in new tab on click. |
|
|
268
|
-
| `header` | `string | ReactElement<unknown, string | JSXElementConstructor<any
|
|
268
|
+
| `header` | `string | HeaderActionProps | ReactElement<unknown, string | JSXElementConstructor<any>>` | No | — | The header props of the card. |
|
|
269
269
|
| `onClick` | `(event: MouseEvent<HTMLAnchorElement | HTMLDivElement, MouseEvent>) => void` | No | — | Event handler that gets called when the card is clicked. |
|
|
270
270
|
| `title` | `string` | No | — | @deprecated Use header instead. |
|
|
271
271
|
| `UNSAFE_className` | `{ container?: string; header?: string; }` | No | — | **Use at your own risk:** Custom class names for specific elements. This should only be used as a **last resort**. Us... |
|
package/dist/docs/Icon/Icon.md
CHANGED
|
@@ -415,6 +415,7 @@ export function IconSizesExample() {
|
|
|
415
415
|
| | `export` |
|
|
416
416
|
| | `filter` |
|
|
417
417
|
| | `future` |
|
|
418
|
+
| | `history` |
|
|
418
419
|
| | `import` |
|
|
419
420
|
| | `redo` |
|
|
420
421
|
| | `remove` |
|
|
@@ -582,7 +583,7 @@ necessary.
|
|
|
582
583
|
| Prop | Type | Required | Default | Description |
|
|
583
584
|
|------|------|----------|---------|-------------|
|
|
584
585
|
| `name` | `IconNames` | Yes | — | The icon to show. |
|
|
585
|
-
| `color` | `"
|
|
586
|
+
| `color` | `"disabled" | "icon" | "task" | "text" | "warning" | "success" | "blue" | "green" | "yellow" | "red" | "grey" | "white" | "greyBlue" | "lightBlue" | "orange" | "navy" | "interactive" | ... 32 more ... | "brandHighlight"` | No | — | Determines the color of the icon. Some icons have a default system colour like quotes, jobs, and invoices. Others tha... |
|
|
586
587
|
| `customColor` | `string` | No | — | Sets a custom color for the icon. Can be a rgb() or hex value. |
|
|
587
588
|
| `size` | `"base" | "large" | "small"` | No | `base` | Changes the size to small or large. |
|
|
588
589
|
| `testID` | `string` | No | — | Used to locate this view in end-to-end tests |
|
package/dist/docs/Menu/Menu.md
CHANGED
|
@@ -502,7 +502,7 @@ and should not be used for new implementations.
|
|
|
502
502
|
| Prop | Type | Required | Default | Description |
|
|
503
503
|
|------|------|----------|---------|-------------|
|
|
504
504
|
| `name` | `IconNames` | Yes | — | The icon to show. |
|
|
505
|
-
| `color` | `"
|
|
505
|
+
| `color` | `"disabled" | "icon" | "task" | "text" | "warning" | "success" | "blue" | "green" | "yellow" | "red" | "grey" | "white" | "greyBlue" | "lightBlue" | "orange" | "navy" | "interactive" | ... 32 more ... | "brandHighlight"` | No | — | Determines the color of the icon. Some icons have a default system colour like quotes, jobs, and invoices. Others tha... |
|
|
506
506
|
| `customColor` | `string` | No | — | Sets a custom color for the icon. Can be a rgb() or hex value. |
|
|
507
507
|
| `size` | `"base" | "large" | "small"` | No | `base` | Changes the size to small or large. |
|
|
508
508
|
| `testID` | `string` | No | — | Used to locate this view in end-to-end tests |
|
package/dist/docs/index.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
[ActivityIndicator](./ActivityIndicator/ActivityIndicator.md)
|
|
2
|
-
[AnimatedSwitcher](./AnimatedSwitcher/AnimatedSwitcher.md)
|
|
3
2
|
[Animation](./Animation/Animation.md)
|
|
4
3
|
[AtlantisThemeContext](./AtlantisThemeContext/AtlantisThemeContext.md)
|
|
5
4
|
[Autocomplete](./Autocomplete/Autocomplete.md)
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var ActivityIndicator = require('./ActivityIndicator-cjs.js');
|
|
4
|
-
var AnimatedSwitcher = require('./AnimatedSwitcher-cjs.js');
|
|
5
4
|
var AtlantisContext = require('./AtlantisContext-cjs.js');
|
|
6
5
|
var AtlantisThemeContext = require('./AtlantisThemeContext-cjs.js');
|
|
7
6
|
var updateTheme = require('./updateTheme-cjs.js');
|
|
@@ -91,7 +90,6 @@ var showToast = require('./showToast-cjs.js');
|
|
|
91
90
|
var Tooltip = require('./Tooltip-cjs.js');
|
|
92
91
|
var Typography = require('./Typography-cjs.js');
|
|
93
92
|
require('classnames');
|
|
94
|
-
require('framer-motion');
|
|
95
93
|
require('@jobber/design');
|
|
96
94
|
require('./_commonjsHelpers-cjs.js');
|
|
97
95
|
require('./identity-cjs.js');
|
|
@@ -127,6 +125,7 @@ require('./debounce-cjs.js');
|
|
|
127
125
|
require('./ComboboxContent-cjs.js');
|
|
128
126
|
require('./ComboboxContentSearch-cjs.js');
|
|
129
127
|
require('./ComboboxContentList-cjs.js');
|
|
128
|
+
require('framer-motion');
|
|
130
129
|
require('./ComboboxOption-cjs.js');
|
|
131
130
|
require('./ComboboxLoadMore-cjs.js');
|
|
132
131
|
require('./ComboboxContentHeader-cjs.js');
|
|
@@ -202,7 +201,6 @@ function isNormalClick(evt) {
|
|
|
202
201
|
}
|
|
203
202
|
|
|
204
203
|
exports.ActivityIndicator = ActivityIndicator.ActivityIndicator;
|
|
205
|
-
exports.AnimatedSwitcher = AnimatedSwitcher.AnimatedSwitcher;
|
|
206
204
|
exports.AtlantisContext = AtlantisContext.AtlantisContext;
|
|
207
205
|
exports.atlantisContextDefaultValues = AtlantisContext.atlantisContextDefaultValues;
|
|
208
206
|
exports.useAtlantisContext = AtlantisContext.useAtlantisContext;
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { A as ActivityIndicator } from './ActivityIndicator-es.js';
|
|
2
|
-
export { A as AnimatedSwitcher } from './AnimatedSwitcher-es.js';
|
|
3
2
|
export { A as AtlantisContext, a as atlantisContextDefaultValues, u as useAtlantisContext } from './AtlantisContext-es.js';
|
|
4
3
|
export { A as AtlantisThemeContextProvider, T as THEME_CHANGE_EVENT, a as atlantisThemeContextDefaultValues, u as useAtlantisTheme } from './AtlantisThemeContext-es.js';
|
|
5
4
|
export { u as updateTheme } from './updateTheme-es.js';
|
|
@@ -89,7 +88,6 @@ export { T as Toast, s as showToast } from './showToast-es.js';
|
|
|
89
88
|
export { T as Tooltip } from './Tooltip-es.js';
|
|
90
89
|
export { T as Typography } from './Typography-es.js';
|
|
91
90
|
import 'classnames';
|
|
92
|
-
import 'framer-motion';
|
|
93
91
|
import '@jobber/design';
|
|
94
92
|
import './_commonjsHelpers-es.js';
|
|
95
93
|
import './identity-es.js';
|
|
@@ -125,6 +123,7 @@ import './debounce-es.js';
|
|
|
125
123
|
import './ComboboxContent-es.js';
|
|
126
124
|
import './ComboboxContentSearch-es.js';
|
|
127
125
|
import './ComboboxContentList-es.js';
|
|
126
|
+
import 'framer-motion';
|
|
128
127
|
import './ComboboxOption-es.js';
|
|
129
128
|
import './ComboboxLoadMore-es.js';
|
|
130
129
|
import './ComboboxContentHeader-es.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.14.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -30,11 +30,6 @@
|
|
|
30
30
|
"import": "./dist/ActivityIndicator/index.mjs",
|
|
31
31
|
"require": "./dist/ActivityIndicator/index.cjs"
|
|
32
32
|
},
|
|
33
|
-
"./AnimatedSwitcher": {
|
|
34
|
-
"types": "./dist/AnimatedSwitcher/index.d.ts",
|
|
35
|
-
"import": "./dist/AnimatedSwitcher/index.mjs",
|
|
36
|
-
"require": "./dist/AnimatedSwitcher/index.cjs"
|
|
37
|
-
},
|
|
38
33
|
"./AtlantisContext": {
|
|
39
34
|
"types": "./dist/AtlantisContext/index.d.ts",
|
|
40
35
|
"import": "./dist/AtlantisContext/index.mjs",
|
|
@@ -497,7 +492,7 @@
|
|
|
497
492
|
"devDependencies": {
|
|
498
493
|
"@apollo/client": "^3.7.10",
|
|
499
494
|
"@csstools/postcss-global-data": "^1.0.3",
|
|
500
|
-
"@jobber/design": "0.
|
|
495
|
+
"@jobber/design": "0.104.0",
|
|
501
496
|
"@jobber/hooks": "2.21.0",
|
|
502
497
|
"@rollup/plugin-alias": "^5.1.0",
|
|
503
498
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
@@ -551,5 +546,5 @@
|
|
|
551
546
|
"> 1%",
|
|
552
547
|
"IE 10"
|
|
553
548
|
],
|
|
554
|
-
"gitHead": "
|
|
549
|
+
"gitHead": "783af69e2c4ea59128eaba44e0b96e21b783955d"
|
|
555
550
|
}
|
package/AnimatedSwitcher.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./dist/AnimatedSwitcher";
|
package/AnimatedSwitcher.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true,
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var AnimatedSwitcher = require("./dist/AnimatedSwitcher");
|
|
8
|
-
|
|
9
|
-
Object.keys(AnimatedSwitcher).forEach(function(key) {
|
|
10
|
-
if (key === "default" || key === "__esModule") return;
|
|
11
|
-
Object.defineProperty(exports, key, {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function get() {
|
|
14
|
-
return AnimatedSwitcher[key];
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { ReactElement } from "react";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import type { IconNames } from "@jobber/design";
|
|
4
|
-
export interface AnimatedSwitcherProps {
|
|
5
|
-
/**
|
|
6
|
-
* Determines when to switch the component to the `switchTo` prop.
|
|
7
|
-
*
|
|
8
|
-
* @default false
|
|
9
|
-
*/
|
|
10
|
-
readonly switched: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* The component that shows up when the `switched` prop is `false`
|
|
13
|
-
*/
|
|
14
|
-
readonly initialChild: ReactElement;
|
|
15
|
-
/**
|
|
16
|
-
* The component that shows up when the `switched` prop is `true`
|
|
17
|
-
*/
|
|
18
|
-
readonly switchTo: ReactElement;
|
|
19
|
-
/**
|
|
20
|
-
* Change the transition between 2 elements.
|
|
21
|
-
*/
|
|
22
|
-
readonly type?: "slideFromBottom" | "fade";
|
|
23
|
-
}
|
|
24
|
-
export declare function AnimatedSwitcher({ initialChild, switched, switchTo, type, }: AnimatedSwitcherProps): React.JSX.Element;
|
|
25
|
-
export declare namespace AnimatedSwitcher {
|
|
26
|
-
var Icon: ({ switchToIcon, switched, initialIcon, }: AnimatedSwitcherIconProps) => React.JSX.Element;
|
|
27
|
-
}
|
|
28
|
-
interface AnimatedSwitcherIconProps extends Pick<AnimatedSwitcherProps, "switched"> {
|
|
29
|
-
readonly initialIcon: IconNames;
|
|
30
|
-
readonly switchToIcon: IconNames;
|
|
31
|
-
}
|
|
32
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./AnimatedSwitcher";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Variants } from "framer-motion";
|
|
2
|
-
export declare const DURATION_SIMPLE = 0.1;
|
|
3
|
-
export declare const DURATION_AVERAGE = 0.2;
|
|
4
|
-
export declare const FADE: Variants;
|
|
5
|
-
export declare const SLIDE_IN_UP: Variants;
|
|
6
|
-
export declare const SLIDE_IN_DOWN: Variants;
|
|
7
|
-
export declare const SPIN_COUNTER_CLOCK_WISE: Variants;
|
|
8
|
-
export declare const SPIN_CLOCK_WISE: Variants;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var framerMotion = require('framer-motion');
|
|
5
|
-
var Icon = require('./Icon-cjs.js');
|
|
6
|
-
|
|
7
|
-
const DURATION_SIMPLE = 0.1;
|
|
8
|
-
const DURATION_AVERAGE = 0.2;
|
|
9
|
-
const FADE = {
|
|
10
|
-
visible: { opacity: 1 },
|
|
11
|
-
hidden: { opacity: 0 },
|
|
12
|
-
};
|
|
13
|
-
const SLIDE_IN_UP = {
|
|
14
|
-
visible: { y: 0, opacity: 1 },
|
|
15
|
-
hidden: { y: "10%", opacity: 0 },
|
|
16
|
-
};
|
|
17
|
-
const SLIDE_IN_DOWN = {
|
|
18
|
-
visible: { y: 0, opacity: 1 },
|
|
19
|
-
hidden: { y: "-10%", opacity: 0 },
|
|
20
|
-
};
|
|
21
|
-
const SPIN_COUNTER_CLOCK_WISE = {
|
|
22
|
-
visible: {
|
|
23
|
-
rotate: 0,
|
|
24
|
-
scale: 1,
|
|
25
|
-
transition: { duration: DURATION_AVERAGE, ease: "easeOut" },
|
|
26
|
-
},
|
|
27
|
-
hidden: {
|
|
28
|
-
rotate: 180,
|
|
29
|
-
scale: 0.6,
|
|
30
|
-
transition: { duration: DURATION_AVERAGE, ease: "easeIn" },
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
const SPIN_CLOCK_WISE = {
|
|
34
|
-
visible: {
|
|
35
|
-
rotate: 0,
|
|
36
|
-
scale: 1,
|
|
37
|
-
transition: { duration: DURATION_AVERAGE, ease: "easeOut" },
|
|
38
|
-
},
|
|
39
|
-
hidden: {
|
|
40
|
-
rotate: -180,
|
|
41
|
-
scale: 0.6,
|
|
42
|
-
transition: { duration: DURATION_AVERAGE, ease: "easeIn" },
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
function AnimatedSwitcher({ initialChild, switched, switchTo, type = "slideFromBottom", }) {
|
|
47
|
-
const [ref, setRef] = React.useState(null);
|
|
48
|
-
const isSwitchingBetweenIcons = initialChild.type === Icon.Icon && switchTo.type === Icon.Icon;
|
|
49
|
-
const { key, transition, child, duration } = getChildData();
|
|
50
|
-
return (React.createElement(framerMotion.AnimatePresence, { mode: "wait", initial: false },
|
|
51
|
-
React.createElement(framerMotion.motion.div, { ref: setRef, key: key, variants: transition, initial: "hidden", animate: "visible", exit: "hidden", transition: { duration }, style: { display: getDisplayValue() } }, child)));
|
|
52
|
-
function getDisplayValue() {
|
|
53
|
-
if (ref === null || ref === void 0 ? void 0 : ref.firstElementChild) {
|
|
54
|
-
return window.getComputedStyle(ref.firstElementChild).display;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function getChildData() {
|
|
58
|
-
let data = {
|
|
59
|
-
key: `${initialChild.type.toString()}_1`,
|
|
60
|
-
child: initialChild,
|
|
61
|
-
};
|
|
62
|
-
if (switched) {
|
|
63
|
-
data = { key: `${switchTo.type.toString()}_2`, child: switchTo };
|
|
64
|
-
}
|
|
65
|
-
return Object.assign(Object.assign({}, data), { transition: getTransitionType(), duration: getTransitionDuration() });
|
|
66
|
-
}
|
|
67
|
-
function getTransitionType() {
|
|
68
|
-
if (isSwitchingBetweenIcons) {
|
|
69
|
-
if (switched)
|
|
70
|
-
return SPIN_COUNTER_CLOCK_WISE;
|
|
71
|
-
return SPIN_CLOCK_WISE;
|
|
72
|
-
}
|
|
73
|
-
else if (type === "fade") {
|
|
74
|
-
return FADE;
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
if (switched)
|
|
78
|
-
return SLIDE_IN_UP;
|
|
79
|
-
return SLIDE_IN_DOWN;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function getTransitionDuration() {
|
|
83
|
-
switch (type) {
|
|
84
|
-
case "fade":
|
|
85
|
-
return DURATION_AVERAGE;
|
|
86
|
-
default:
|
|
87
|
-
return DURATION_SIMPLE;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
AnimatedSwitcher.Icon = function AnimatedSwitcherIcon({ switchToIcon, switched, initialIcon, }) {
|
|
92
|
-
return (React.createElement(AnimatedSwitcher, { switched: switched, initialChild: React.createElement(Icon.Icon, { name: initialIcon }), switchTo: React.createElement(Icon.Icon, { name: switchToIcon }) }));
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
exports.AnimatedSwitcher = AnimatedSwitcher;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import React__default, { useState } from 'react';
|
|
2
|
-
import { AnimatePresence, motion } from 'framer-motion';
|
|
3
|
-
import { I as Icon } from './Icon-es.js';
|
|
4
|
-
|
|
5
|
-
const DURATION_SIMPLE = 0.1;
|
|
6
|
-
const DURATION_AVERAGE = 0.2;
|
|
7
|
-
const FADE = {
|
|
8
|
-
visible: { opacity: 1 },
|
|
9
|
-
hidden: { opacity: 0 },
|
|
10
|
-
};
|
|
11
|
-
const SLIDE_IN_UP = {
|
|
12
|
-
visible: { y: 0, opacity: 1 },
|
|
13
|
-
hidden: { y: "10%", opacity: 0 },
|
|
14
|
-
};
|
|
15
|
-
const SLIDE_IN_DOWN = {
|
|
16
|
-
visible: { y: 0, opacity: 1 },
|
|
17
|
-
hidden: { y: "-10%", opacity: 0 },
|
|
18
|
-
};
|
|
19
|
-
const SPIN_COUNTER_CLOCK_WISE = {
|
|
20
|
-
visible: {
|
|
21
|
-
rotate: 0,
|
|
22
|
-
scale: 1,
|
|
23
|
-
transition: { duration: DURATION_AVERAGE, ease: "easeOut" },
|
|
24
|
-
},
|
|
25
|
-
hidden: {
|
|
26
|
-
rotate: 180,
|
|
27
|
-
scale: 0.6,
|
|
28
|
-
transition: { duration: DURATION_AVERAGE, ease: "easeIn" },
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
const SPIN_CLOCK_WISE = {
|
|
32
|
-
visible: {
|
|
33
|
-
rotate: 0,
|
|
34
|
-
scale: 1,
|
|
35
|
-
transition: { duration: DURATION_AVERAGE, ease: "easeOut" },
|
|
36
|
-
},
|
|
37
|
-
hidden: {
|
|
38
|
-
rotate: -180,
|
|
39
|
-
scale: 0.6,
|
|
40
|
-
transition: { duration: DURATION_AVERAGE, ease: "easeIn" },
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
function AnimatedSwitcher({ initialChild, switched, switchTo, type = "slideFromBottom", }) {
|
|
45
|
-
const [ref, setRef] = useState(null);
|
|
46
|
-
const isSwitchingBetweenIcons = initialChild.type === Icon && switchTo.type === Icon;
|
|
47
|
-
const { key, transition, child, duration } = getChildData();
|
|
48
|
-
return (React__default.createElement(AnimatePresence, { mode: "wait", initial: false },
|
|
49
|
-
React__default.createElement(motion.div, { ref: setRef, key: key, variants: transition, initial: "hidden", animate: "visible", exit: "hidden", transition: { duration }, style: { display: getDisplayValue() } }, child)));
|
|
50
|
-
function getDisplayValue() {
|
|
51
|
-
if (ref === null || ref === void 0 ? void 0 : ref.firstElementChild) {
|
|
52
|
-
return window.getComputedStyle(ref.firstElementChild).display;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function getChildData() {
|
|
56
|
-
let data = {
|
|
57
|
-
key: `${initialChild.type.toString()}_1`,
|
|
58
|
-
child: initialChild,
|
|
59
|
-
};
|
|
60
|
-
if (switched) {
|
|
61
|
-
data = { key: `${switchTo.type.toString()}_2`, child: switchTo };
|
|
62
|
-
}
|
|
63
|
-
return Object.assign(Object.assign({}, data), { transition: getTransitionType(), duration: getTransitionDuration() });
|
|
64
|
-
}
|
|
65
|
-
function getTransitionType() {
|
|
66
|
-
if (isSwitchingBetweenIcons) {
|
|
67
|
-
if (switched)
|
|
68
|
-
return SPIN_COUNTER_CLOCK_WISE;
|
|
69
|
-
return SPIN_CLOCK_WISE;
|
|
70
|
-
}
|
|
71
|
-
else if (type === "fade") {
|
|
72
|
-
return FADE;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
if (switched)
|
|
76
|
-
return SLIDE_IN_UP;
|
|
77
|
-
return SLIDE_IN_DOWN;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function getTransitionDuration() {
|
|
81
|
-
switch (type) {
|
|
82
|
-
case "fade":
|
|
83
|
-
return DURATION_AVERAGE;
|
|
84
|
-
default:
|
|
85
|
-
return DURATION_SIMPLE;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
AnimatedSwitcher.Icon = function AnimatedSwitcherIcon({ switchToIcon, switched, initialIcon, }) {
|
|
90
|
-
return (React__default.createElement(AnimatedSwitcher, { switched: switched, initialChild: React__default.createElement(Icon, { name: initialIcon }), switchTo: React__default.createElement(Icon, { name: switchToIcon }) }));
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export { AnimatedSwitcher as A };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# AnimatedSwitcher
|
|
2
|
-
|
|
3
|
-
Smoothly switch between two components that aim to add delight when the user
|
|
4
|
-
interacts with them.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Configuration
|
|
8
|
-
|
|
9
|
-
Animating between 2 icons is done in a more opinionated way where it would spin
|
|
10
|
-
from 1 icon to another. The animation reverses when you want to go back to the
|
|
11
|
-
initial icon. See
|
|
12
|
-
[AnimatedSwitcher/Icon example](/storybook/web/?path=/story/components-utilities-animatedswitcher--icon).
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## Props
|
|
16
|
-
|
|
17
|
-
### Web
|
|
18
|
-
|
|
19
|
-
#### AnimatedSwitcher
|
|
20
|
-
|
|
21
|
-
| Prop | Type | Required | Default | Description |
|
|
22
|
-
|------|------|----------|---------|-------------|
|
|
23
|
-
| `initialChild` | `ReactElement<unknown, string | JSXElementConstructor<any>>` | Yes | — | The component that shows up when the `switched` prop is `false` |
|
|
24
|
-
| `switched` | `boolean` | Yes | `false` | Determines when to switch the component to the `switchTo` prop. |
|
|
25
|
-
| `switchTo` | `ReactElement<unknown, string | JSXElementConstructor<any>>` | Yes | — | The component that shows up when the `switched` prop is `true` |
|
|
26
|
-
| `type` | `"fade" | "slideFromBottom"` | No | `slideFromBottom` | Change the transition between 2 elements. |
|
|
27
|
-
|
|
28
|
-
#### AnimatedSwitcher.Icon
|
|
29
|
-
|
|
30
|
-
| Prop | Type | Required | Default | Description |
|
|
31
|
-
|------|------|----------|---------|-------------|
|
|
32
|
-
| `initialIcon` | `IconNames` | Yes | — | |
|
|
33
|
-
| `switched` | `boolean` | Yes | `false` | Determines when to switch the component to the `switchTo` prop. |
|
|
34
|
-
| `switchToIcon` | `IconNames` | Yes | — | |
|