@jobber/components 4.79.1 → 4.79.2-STCJS-to-.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/dist/AnimatedPresence/AnimatedPresence.d.ts +1 -1
- package/dist/AnimatedSwitcher/AnimatedSwitcher.d.ts +1 -1
- package/dist/Autocomplete/Autocomplete.d.ts +1 -1
- package/dist/Avatar/Avatar.d.ts +1 -1
- package/dist/Banner/Banner.d.ts +1 -1
- package/dist/Button/Button.d.ts +1 -1
- package/dist/ButtonDismiss/ButtonDismiss.d.ts +2 -2
- package/dist/Card/Card.d.ts +1 -1
- package/dist/Checkbox/Checkbox.d.ts +1 -1
- package/dist/Chip/Chip.d.ts +1 -0
- package/dist/Chips/Chips.d.ts +1 -0
- package/dist/Combobox/Combobox.d.ts +1 -0
- package/dist/Combobox/hooks/useMakeComboboxHandlers.d.ts +1 -1
- package/dist/ConfirmationModal/ConfirmationModal.d.ts +1 -1
- package/dist/Content/Content.d.ts +1 -1
- package/dist/Countdown/Countdown.d.ts +1 -1
- package/dist/DataDump/DataDump.d.ts +1 -1
- package/dist/DataList/DataList.const.d.ts +1 -0
- package/dist/DataList/DataList.d.ts +1 -0
- package/dist/DataTable/DataTable.d.ts +1 -0
- package/dist/DatePicker/DatePicker.d.ts +1 -1
- package/dist/DescriptionList/DescriptionList.d.ts +2 -2
- package/dist/Disclosure/Disclosure.d.ts +1 -1
- package/dist/Divider/Divider.d.ts +1 -1
- package/dist/Drawer/Drawer.d.ts +1 -1
- package/dist/Emphasis/Emphasis.d.ts +3 -3
- package/dist/FeatureSwitch/FeatureSwitch.d.ts +1 -1
- package/dist/Flex/Flex.d.ts +1 -1
- package/dist/Form/Form.d.ts +1 -0
- package/dist/FormField/FormField.d.ts +1 -0
- package/dist/FormatDate/FormatDate.d.ts +1 -1
- package/dist/FormatEmail/FormatEmail.d.ts +1 -1
- package/dist/FormatFile/FormatFile.d.ts +1 -1
- package/dist/FormatRelativeDateTime/FormatRelativeDateTime.d.ts +1 -1
- package/dist/FormatTime/FormatTime.d.ts +1 -1
- package/dist/Gallery/Gallery.d.ts +1 -0
- package/dist/Glimmer/Glimmer.d.ts +1 -1
- package/dist/Grid/Grid.d.ts +1 -1
- package/dist/Heading/Heading.d.ts +1 -1
- package/dist/Icon/Icon.d.ts +1 -0
- package/dist/InlineLabel/InlineLabel.d.ts +4 -4
- package/dist/InputAvatar/InputAvatar.d.ts +1 -1
- package/dist/InputDate/InputDate.d.ts +1 -1
- package/dist/InputEmail/InputEmail.d.ts +1 -1
- package/dist/InputFile/InputFile.d.ts +1 -1
- package/dist/InputGroup/InputGroup.d.ts +1 -1
- package/dist/InputNumber/InputNumber.d.ts +2 -1
- package/dist/InputPassword/InputPassword.d.ts +3 -3
- package/dist/InputPhoneNumber/InputPhoneNumber.d.ts +1 -1
- package/dist/InputText/InputText.d.ts +1 -0
- package/dist/InputTime/InputTime.d.ts +1 -0
- package/dist/InputValidation/InputValidation.d.ts +1 -1
- package/dist/LightBox/LightBox.d.ts +1 -1
- package/dist/Link/Link.d.ts +1 -0
- package/dist/List/List.d.ts +1 -1
- package/dist/Markdown/Markdown.d.ts +1 -1
- package/dist/Menu/Menu.d.ts +5 -4
- package/dist/Modal/Modal.d.ts +1 -0
- package/dist/MultiSelect/MultiSelect.d.ts +1 -1
- package/dist/Page/Page.d.ts +1 -1
- package/dist/Popover/Popover.d.ts +1 -0
- package/dist/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/RecurringSelect/RecurringSelect.d.ts +1 -1
- package/dist/RecurringSelect/components/DayOfMonthSelect.d.ts +2 -2
- package/dist/RecurringSelect/components/WeeklySelect.d.ts +2 -2
- package/dist/Select/Select.d.ts +1 -1
- package/dist/Spinner/Spinner.d.ts +1 -1
- package/dist/StatusLabel/StatusLabel.d.ts +1 -1
- package/dist/Switch/Switch.d.ts +1 -1
- package/dist/Table/Table.d.ts +2 -2
- package/dist/Tabs/Tabs.d.ts +1 -1
- package/dist/Text/Text.d.ts +2 -2
- package/dist/Toast/Toast.d.ts +1 -1
- package/dist/Tooltip/Tooltip.d.ts +1 -1
- package/dist/Typography/Typography.d.ts +2 -2
- package/dist/index.d.ts +72 -0
- package/dist/index.js +6479 -0
- package/package.json +6 -10
- package/rollup.config.js +15 -78
- package/dist/AnimatedPresence/index.js +0 -12
- package/dist/AnimatedPresence-20a02aaa.js +0 -104
- package/dist/AnimatedSwitcher/index.js +0 -13
- package/dist/AnimatedSwitcher-3d45ec5d.js +0 -96
- package/dist/Autocomplete/index.js +0 -209
- package/dist/Avatar/index.js +0 -15
- package/dist/Avatar-76a799fa.js +0 -78
- package/dist/Banner/index.js +0 -110
- package/dist/Button/index.js +0 -16
- package/dist/Button-b73a5e01.js +0 -57
- package/dist/ButtonDismiss/index.js +0 -17
- package/dist/ButtonDismiss-350af163.js +0 -14
- package/dist/Card/colors.css.d.ts +0 -89
- package/dist/Card/index.js +0 -24
- package/dist/Card-426a68a8.js +0 -93
- package/dist/Checkbox/index.js +0 -19
- package/dist/Checkbox-99f6297f.js +0 -64
- package/dist/Chip/index.js +0 -40
- package/dist/Chip-c91fd6c8.js +0 -89
- package/dist/Chips/index.js +0 -524
- package/dist/Combobox/index.js +0 -38
- package/dist/Combobox-ca9ac94b.js +0 -474
- package/dist/ConfirmationModal/index.js +0 -31
- package/dist/ConfirmationModal-f1a049fb.js +0 -100
- package/dist/Content/Spacing.css.d.ts +0 -13
- package/dist/Content/index.js +0 -12
- package/dist/Content-e3f7b6fc.js +0 -24
- package/dist/Countdown/index.js +0 -72
- package/dist/DataDump/index.js +0 -37
- package/dist/DataList/index.js +0 -1341
- package/dist/DataTable/index.js +0 -302
- package/dist/DatePicker/index.js +0 -20
- package/dist/DatePicker-64c5ab1a.js +0 -134
- package/dist/DescriptionList/index.js +0 -24
- package/dist/Disclosure/index.js +0 -46
- package/dist/Divider/index.js +0 -29
- package/dist/Drawer/index.js +0 -50
- package/dist/Emphasis/index.js +0 -13
- package/dist/Emphasis-bda56d3b.js +0 -19
- package/dist/FeatureSwitch/index.js +0 -70
- package/dist/Flex/index.js +0 -40
- package/dist/Form/index.js +0 -56
- package/dist/FormField/index.js +0 -25
- package/dist/FormField-b4e6c549.js +0 -254
- package/dist/FormatDate/index.js +0 -11
- package/dist/FormatDate-70ea5b43.js +0 -34
- package/dist/FormatEmail/index.js +0 -23
- package/dist/FormatFile/index.js +0 -36
- package/dist/FormatFile-652edda8.js +0 -162
- package/dist/FormatRelativeDateTime/index.js +0 -72
- package/dist/FormatTime/index.js +0 -36
- package/dist/Gallery/Gallery.css.d.ts +0 -9
- package/dist/Gallery/index.js +0 -99
- package/dist/Glimmer/index.js +0 -15
- package/dist/Glimmer/style/Shape.css.d.ts +0 -9
- package/dist/Glimmer/style/Sizes.css.d.ts +0 -10
- package/dist/Glimmer/style/Timing.css.d.ts +0 -6
- package/dist/Glimmer-7c317864.js +0 -77
- package/dist/Grid/GridAlign.css.d.ts +0 -8
- package/dist/Grid/index.js +0 -76
- package/dist/Heading/index.js +0 -14
- package/dist/Heading-1e8e4bd3.js +0 -55
- package/dist/Icon/index.js +0 -11
- package/dist/Icon-405a216c.js +0 -40
- package/dist/InlineLabel/index.js +0 -13
- package/dist/InlineLabel-a6557829.js +0 -28
- package/dist/InputAvatar/index.js +0 -71
- package/dist/InputDate/index.js +0 -58
- package/dist/InputEmail/index.js +0 -44
- package/dist/InputFile/index.js +0 -26
- package/dist/InputFile-c9eeb04b.js +0 -188
- package/dist/InputGroup/index.js +0 -12
- package/dist/InputGroup-8d4fd4eb.js +0 -33
- package/dist/InputNumber/index.js +0 -26
- package/dist/InputNumber-ceae3872.js +0 -62
- package/dist/InputPassword/index.js +0 -42
- package/dist/InputPhoneNumber/index.js +0 -117
- package/dist/InputText/index.js +0 -26
- package/dist/InputText-6e356985.js +0 -101
- package/dist/InputTime/index.js +0 -210
- package/dist/InputValidation/index.js +0 -17
- package/dist/InputValidation-05e839fa.js +0 -29
- package/dist/LightBox/index.js +0 -24
- package/dist/LightBox-a89d8863.js +0 -117
- package/dist/Link/index.js +0 -15
- package/dist/List/index.js +0 -93
- package/dist/Markdown/index.js +0 -19
- package/dist/Markdown-f7c55304.js +0 -62
- package/dist/Menu/index.js +0 -21
- package/dist/Menu-81b12936.js +0 -139
- package/dist/Modal/Sizes.css.d.ts +0 -6
- package/dist/Modal/index.js +0 -25
- package/dist/Modal-a0627c92.js +0 -71
- package/dist/MultiSelect/index.js +0 -183
- package/dist/Option-8565da71.js +0 -19
- package/dist/Page/index.js +0 -78
- package/dist/Popover/index.js +0 -61
- package/dist/ProgressBar/Sizes.css.d.ts +0 -7
- package/dist/ProgressBar/index.js +0 -12
- package/dist/ProgressBar-b68edc8f.js +0 -43
- package/dist/RadioGroup/index.js +0 -16
- package/dist/RadioGroup-ca7a5978.js +0 -47
- package/dist/RecurringSelect/index.js +0 -228
- package/dist/Select/index.js +0 -27
- package/dist/Spinner/index.js +0 -12
- package/dist/Spinner-9d8fc7ff.js +0 -24
- package/dist/StatusLabel/index.js +0 -30
- package/dist/Switch/index.js +0 -13
- package/dist/Switch-7d4aa7c3.js +0 -56
- package/dist/Table/index.js +0 -66
- package/dist/Tabs/index.js +0 -80
- package/dist/Text/index.js +0 -13
- package/dist/Text-259af966.js +0 -31
- package/dist/Toast/index.js +0 -111
- package/dist/Tooltip/index.js +0 -15
- package/dist/Tooltip-27771182.js +0 -111
- package/dist/Typography/css/Emphasis.css.d.ts +0 -6
- package/dist/Typography/css/FontFamilies.css.d.ts +0 -6
- package/dist/Typography/css/FontSizes.css.d.ts +0 -12
- package/dist/Typography/css/FontWeights.css.d.ts +0 -10
- package/dist/Typography/css/TextAlignment.css.d.ts +0 -7
- package/dist/Typography/css/TextCases.css.d.ts +0 -7
- package/dist/Typography/css/TextColors.css.d.ts +0 -22
- package/dist/Typography/css/Truncate.css.d.ts +0 -5
- package/dist/Typography/css/Typography.css.d.ts +0 -5
- package/dist/Typography/index.js +0 -12
- package/dist/Typography-c45bf216.js +0 -62
- package/dist/getAtlantisConfig-0f3e8af2.js +0 -13
- package/dist/style-inject.es-9d2f5f4e.js +0 -30
- package/dist/tslib.es6-754e2961.js +0 -46
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.79.
|
|
3
|
+
"version": "4.79.2-STCJS-to-.2+561925cc",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"dist/*"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@jobber/design": "^0.53.
|
|
23
|
-
"@jobber/formatters": "
|
|
22
|
+
"@jobber/design": "^0.53.1-STCJS-to-.27+561925cc",
|
|
23
|
+
"@jobber/formatters": "^0.2.2",
|
|
24
24
|
"@jobber/hooks": "^2.8.2",
|
|
25
25
|
"@popperjs/core": "^2.0.6",
|
|
26
26
|
"@std-proposal/temporal": "0.0.1",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"@types/react-datepicker": "^4.8.0",
|
|
31
31
|
"@types/react-router": "5.1.7",
|
|
32
32
|
"@types/react-router-dom": "^5.3.3",
|
|
33
|
-
"@types/uuid": "^8.3.3",
|
|
34
33
|
"axios": "^0.21.2",
|
|
35
34
|
"classnames": "^2.3.2",
|
|
36
35
|
"color": "^3.1.2",
|
|
@@ -45,8 +44,7 @@
|
|
|
45
44
|
"react-popper": "^2.2.5",
|
|
46
45
|
"react-router-dom": "^5.3.4",
|
|
47
46
|
"time-input-polyfill": "^1.0.7",
|
|
48
|
-
"ts-xor": "^1.0.8"
|
|
49
|
-
"uuid": "^8.3.2"
|
|
47
|
+
"ts-xor": "^1.0.8"
|
|
50
48
|
},
|
|
51
49
|
"devDependencies": {
|
|
52
50
|
"@csstools/postcss-global-data": "^1.0.3",
|
|
@@ -59,7 +57,6 @@
|
|
|
59
57
|
"@types/glob": "^7.1.1",
|
|
60
58
|
"@types/react": "^18.0.28",
|
|
61
59
|
"@types/react-dom": "^18.0.11",
|
|
62
|
-
"@types/uuid": "^8.3.3",
|
|
63
60
|
"autoprefixer": "^9.5.1",
|
|
64
61
|
"copyfiles": "^2.4.1",
|
|
65
62
|
"glob": "^7.1.4",
|
|
@@ -72,8 +69,7 @@
|
|
|
72
69
|
"rollup-plugin-multi-input": "^1.4.1",
|
|
73
70
|
"rollup-plugin-postcss": "^4.0.2",
|
|
74
71
|
"typed-css-modules": "^0.7.0",
|
|
75
|
-
"typescript": "^4.9.5"
|
|
76
|
-
"uuid": "^8.3.2"
|
|
72
|
+
"typescript": "^4.9.5"
|
|
77
73
|
},
|
|
78
74
|
"peerDependencies": {
|
|
79
75
|
"react": "^18",
|
|
@@ -84,5 +80,5 @@
|
|
|
84
80
|
"> 1%",
|
|
85
81
|
"IE 10"
|
|
86
82
|
],
|
|
87
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "561925cc726c68a73c445026bd0c777dd66f0edf"
|
|
88
84
|
}
|
package/rollup.config.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
/* eslint-disable import/no-default-export */
|
|
2
|
-
import multiInput from "rollup-plugin-multi-input";
|
|
3
2
|
import typescript from "@rollup/plugin-typescript";
|
|
4
3
|
import postcss from "rollup-plugin-postcss";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import postcssImport from "postcss-import";
|
|
5
|
+
import autoprefixer from "autoprefixer";
|
|
6
|
+
import postcssPresetEnv from "postcss-preset-env";
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
|
-
input: `src
|
|
9
|
+
input: `src/index.tsx`,
|
|
10
10
|
plugins: [
|
|
11
|
-
multiInput(),
|
|
12
|
-
typescript({
|
|
13
|
-
tsconfig: "./tsconfig.rollup.json",
|
|
14
|
-
declarationDir: "dist",
|
|
15
|
-
noEmitOnError: true,
|
|
16
|
-
}),
|
|
17
11
|
postcss({
|
|
18
12
|
modules: {
|
|
19
13
|
generateScopedName: "[hash:base64]",
|
|
@@ -21,84 +15,28 @@ export default {
|
|
|
21
15
|
},
|
|
22
16
|
autoModules: false,
|
|
23
17
|
plugins: [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
require.resolve("@jobber/design/foundation.css"),
|
|
29
|
-
require.resolve("@jobber/design/src/responsiveBreakpoints.css"),
|
|
18
|
+
postcssImport({
|
|
19
|
+
path: [
|
|
20
|
+
"@jobber/design/foundation.css",
|
|
21
|
+
"@jobber/design/src/responsiveBreakpoints.css",
|
|
30
22
|
],
|
|
31
23
|
}),
|
|
32
|
-
|
|
24
|
+
autoprefixer,
|
|
25
|
+
postcssPresetEnv({
|
|
33
26
|
stage: 1,
|
|
34
27
|
preserve: true,
|
|
35
28
|
}),
|
|
36
29
|
],
|
|
37
30
|
}),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
copy({
|
|
42
|
-
targets: [
|
|
43
|
-
{ src: "src/Card/colors.css.d.ts", dest: "dist/Card" },
|
|
44
|
-
{ src: "src/Content/Spacing.css.d.ts", dest: "dist/Content" },
|
|
45
|
-
{ src: "src/Gallery/Gallery.css.d.ts", dest: "dist/Gallery" },
|
|
46
|
-
{ src: "src/Grid/GridAlign.css.d.ts", dest: "dist/Grid" },
|
|
47
|
-
{ src: "src/Modal/Sizes.css.d.ts", dest: "dist/Modal" },
|
|
48
|
-
{ src: "src/ProgressBar/Sizes.css.d.ts", dest: "dist/ProgressBar" },
|
|
49
|
-
{
|
|
50
|
-
src: "src/Typography/css/Emphasis.css.d.ts",
|
|
51
|
-
dest: "dist/Typography/css",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
src: "src/Typography/css/FontFamilies.css.d.ts",
|
|
55
|
-
dest: "dist/Typography/css",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
src: "src/Typography/css/FontSizes.css.d.ts",
|
|
59
|
-
dest: "dist/Typography/css",
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
src: "src/Typography/css/FontWeights.css.d.ts",
|
|
63
|
-
dest: "dist/Typography/css",
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
src: "src/Typography/css/TextAlignment.css.d.ts",
|
|
67
|
-
dest: "dist/Typography/css",
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
src: "src/Typography/css/TextCases.css.d.ts",
|
|
71
|
-
dest: "dist/Typography/css",
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
src: "src/Typography/css/TextColors.css.d.ts",
|
|
75
|
-
dest: "dist/Typography/css",
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
src: "src/Typography/css/Truncate.css.d.ts",
|
|
79
|
-
dest: "dist/Typography/css",
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
src: "src/Typography/css/Typography.css.d.ts",
|
|
83
|
-
dest: "dist/Typography/css",
|
|
84
|
-
},
|
|
85
|
-
{ src: "src/Glimmer/style/Shape.css.d.ts", dest: "dist/Glimmer/style" },
|
|
86
|
-
{ src: "src/Glimmer/style/Sizes.css.d.ts", dest: "dist/Glimmer/style" },
|
|
87
|
-
{
|
|
88
|
-
src: "src/Glimmer/style/Timing.css.d.ts",
|
|
89
|
-
dest: "dist/Glimmer/style",
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
src: "src/Combobox/components/ComboboxContent/ComboboxContentList/ComboboxContent.css.d.ts",
|
|
93
|
-
dest: "dist/Combobox/components/ComboboxContent/ComboboxContentList",
|
|
94
|
-
},
|
|
95
|
-
],
|
|
31
|
+
typescript({
|
|
32
|
+
tsconfig: "./tsconfig.rollup.json",
|
|
33
|
+
noEmitOnError: true,
|
|
96
34
|
}),
|
|
97
35
|
],
|
|
98
36
|
output: [
|
|
99
37
|
{
|
|
100
|
-
|
|
101
|
-
format: "
|
|
38
|
+
file: "dist/index.js",
|
|
39
|
+
format: "esm",
|
|
102
40
|
},
|
|
103
41
|
],
|
|
104
42
|
external: [
|
|
@@ -117,7 +55,6 @@ export default {
|
|
|
117
55
|
"color",
|
|
118
56
|
"framer-motion",
|
|
119
57
|
"classnames",
|
|
120
|
-
"uuid",
|
|
121
58
|
new RegExp("lodash/.*"),
|
|
122
59
|
"@std-proposal/temporal",
|
|
123
60
|
"@jobber/design",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var AnimatedPresence = require('../AnimatedPresence-20a02aaa.js');
|
|
6
|
-
require('react');
|
|
7
|
-
require('framer-motion');
|
|
8
|
-
require('@jobber/design');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.AnimatedPresence = AnimatedPresence.AnimatedPresence;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var framerMotion = require('framer-motion');
|
|
5
|
-
var design = require('@jobber/design');
|
|
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
|
-
const TIMING_QUICK = toSeconds(design.tokens["timing-quick"]);
|
|
12
|
-
const TIMING_BASE = toSeconds(design.tokens["timing-base"]);
|
|
13
|
-
const baseTransition = {
|
|
14
|
-
visible: { opacity: 1 },
|
|
15
|
-
hidden: { opacity: 0 },
|
|
16
|
-
};
|
|
17
|
-
const fade = {
|
|
18
|
-
visible: { opacity: 1 },
|
|
19
|
-
hidden: { opacity: 0 },
|
|
20
|
-
};
|
|
21
|
-
const popIn = {
|
|
22
|
-
visible: Object.assign({ scale: 1 }, baseTransition.visible),
|
|
23
|
-
hidden: Object.assign({ scale: 0.95 }, baseTransition.hidden),
|
|
24
|
-
};
|
|
25
|
-
const fromTop = {
|
|
26
|
-
visible: Object.assign({ y: 0 }, baseTransition.visible),
|
|
27
|
-
hidden: Object.assign({ y: -design.tokens["space-base"] }, baseTransition.hidden),
|
|
28
|
-
};
|
|
29
|
-
const fromBottom = {
|
|
30
|
-
visible: Object.assign({ y: 0 }, baseTransition.visible),
|
|
31
|
-
hidden: Object.assign({ y: design.tokens["space-base"] }, baseTransition.hidden),
|
|
32
|
-
};
|
|
33
|
-
const fromLeft = {
|
|
34
|
-
visible: Object.assign({ x: 0 }, baseTransition.visible),
|
|
35
|
-
hidden: Object.assign({ x: -design.tokens["space-base"] }, baseTransition.hidden),
|
|
36
|
-
};
|
|
37
|
-
const fromRight = {
|
|
38
|
-
visible: Object.assign({ x: 0 }, baseTransition.visible),
|
|
39
|
-
hidden: Object.assign({ x: design.tokens["space-base"] }, baseTransition.hidden),
|
|
40
|
-
};
|
|
41
|
-
const fromLeftToRight = {
|
|
42
|
-
initial: Object.assign({ x: -design.tokens["space-base"] }, baseTransition.hidden),
|
|
43
|
-
visible: Object.assign({ x: 0 }, baseTransition.visible),
|
|
44
|
-
hidden: Object.assign({ x: design.tokens["space-base"] }, baseTransition.hidden),
|
|
45
|
-
};
|
|
46
|
-
const fromRightToLeft = {
|
|
47
|
-
initial: Object.assign({ x: design.tokens["space-base"] }, baseTransition.hidden),
|
|
48
|
-
visible: Object.assign({ x: 0 }, baseTransition.visible),
|
|
49
|
-
hidden: Object.assign({ x: -design.tokens["space-base"] }, baseTransition.hidden),
|
|
50
|
-
};
|
|
51
|
-
function toSeconds(ms) {
|
|
52
|
-
return ms / 1000;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function usePreviousValue(value) {
|
|
56
|
-
const [previousValue, setPreviousValue] = React.useState(value);
|
|
57
|
-
React.useEffect(() => {
|
|
58
|
-
setPreviousValue(value);
|
|
59
|
-
}, [value]);
|
|
60
|
-
return [previousValue, setPreviousValue];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const transitions = {
|
|
64
|
-
fromBottom,
|
|
65
|
-
fromTop,
|
|
66
|
-
fromLeft,
|
|
67
|
-
fromRight,
|
|
68
|
-
popIn,
|
|
69
|
-
fromLeftToRight,
|
|
70
|
-
fromRightToLeft,
|
|
71
|
-
fade,
|
|
72
|
-
};
|
|
73
|
-
function AnimatedPresence(props) {
|
|
74
|
-
const shouldReduceMotion = framerMotion.useReducedMotion();
|
|
75
|
-
if (shouldReduceMotion) {
|
|
76
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, props.children);
|
|
77
|
-
}
|
|
78
|
-
return React__default["default"].createElement(InternalAnimatedPresence, Object.assign({}, props));
|
|
79
|
-
}
|
|
80
|
-
function InternalAnimatedPresence({ transition = "fromTop", initial = false, children, }) {
|
|
81
|
-
const transitionVariation = transitions[transition];
|
|
82
|
-
const hasInitialTransition = "initial" in transitionVariation;
|
|
83
|
-
const childCount = React.Children.count(children);
|
|
84
|
-
// Set the initial value to 0 so it staggers the animation on mount when
|
|
85
|
-
// initial is true.
|
|
86
|
-
const [lastChildIndex, setLastChildIndex] = usePreviousValue(0);
|
|
87
|
-
// Whenever the children count changes, update the last index.
|
|
88
|
-
React.useEffect(() => {
|
|
89
|
-
setLastChildIndex(childCount - 1);
|
|
90
|
-
}, [childCount]);
|
|
91
|
-
return (React__default["default"].createElement(framerMotion.AnimatePresence, { initial: initial, mode: "popLayout" }, React.Children.map(children, (child, i) => child && (React__default["default"].createElement(framerMotion.motion.div, { layout: true, variants: transitionVariation, initial: hasInitialTransition ? "initial" : "hidden", animate: "visible", exit: "hidden", transition: {
|
|
92
|
-
duration: TIMING_BASE,
|
|
93
|
-
delay: generateDelayTime(i),
|
|
94
|
-
} }, child)))));
|
|
95
|
-
function generateDelayTime(index) {
|
|
96
|
-
// Don't add a delay if it's already rendered.
|
|
97
|
-
if (lastChildIndex > index)
|
|
98
|
-
return 0;
|
|
99
|
-
// Stagger the animation starting after the previous last child index.
|
|
100
|
-
return (index - lastChildIndex) * TIMING_QUICK;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
exports.AnimatedPresence = AnimatedPresence;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var AnimatedSwitcher = require('../AnimatedSwitcher-3d45ec5d.js');
|
|
6
|
-
require('react');
|
|
7
|
-
require('framer-motion');
|
|
8
|
-
require('../Icon-405a216c.js');
|
|
9
|
-
require('@jobber/design');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.AnimatedSwitcher = AnimatedSwitcher.AnimatedSwitcher;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var framerMotion = require('framer-motion');
|
|
5
|
-
var Icon = require('./Icon-405a216c.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
|
-
const DURATION_SIMPLE = 0.1;
|
|
12
|
-
const DURATION_AVERAGE = 0.2;
|
|
13
|
-
const FADE = {
|
|
14
|
-
visible: { opacity: 1 },
|
|
15
|
-
hidden: { opacity: 0 },
|
|
16
|
-
};
|
|
17
|
-
const SLIDE_IN_UP = {
|
|
18
|
-
visible: { y: 0, opacity: 1 },
|
|
19
|
-
hidden: { y: "10%", opacity: 0 },
|
|
20
|
-
};
|
|
21
|
-
const SLIDE_IN_DOWN = {
|
|
22
|
-
visible: { y: 0, opacity: 1 },
|
|
23
|
-
hidden: { y: "-10%", opacity: 0 },
|
|
24
|
-
};
|
|
25
|
-
const SPIN_COUNTER_CLOCK_WISE = {
|
|
26
|
-
visible: {
|
|
27
|
-
rotate: 0,
|
|
28
|
-
scale: 1,
|
|
29
|
-
transition: { duration: DURATION_AVERAGE, ease: "easeOut" },
|
|
30
|
-
},
|
|
31
|
-
hidden: {
|
|
32
|
-
rotate: 180,
|
|
33
|
-
scale: 0.6,
|
|
34
|
-
transition: { duration: DURATION_AVERAGE, ease: "easeIn" },
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
const SPIN_CLOCK_WISE = {
|
|
38
|
-
visible: {
|
|
39
|
-
rotate: 0,
|
|
40
|
-
scale: 1,
|
|
41
|
-
transition: { duration: DURATION_AVERAGE, ease: "easeOut" },
|
|
42
|
-
},
|
|
43
|
-
hidden: {
|
|
44
|
-
rotate: -180,
|
|
45
|
-
scale: 0.6,
|
|
46
|
-
transition: { duration: DURATION_AVERAGE, ease: "easeIn" },
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
function AnimatedSwitcher({ initialChild, switched, switchTo, type = "slideFromBottom", }) {
|
|
51
|
-
const [ref, setRef] = React.useState(null);
|
|
52
|
-
const isSwitchingBetweenIcons = initialChild.type === Icon.Icon && switchTo.type === Icon.Icon;
|
|
53
|
-
const { key, transition, child, duration } = getChildData();
|
|
54
|
-
return (React__default["default"].createElement(framerMotion.AnimatePresence, { mode: "wait", initial: false },
|
|
55
|
-
React__default["default"].createElement(framerMotion.motion.div, { ref: setRef, key: key, variants: transition, initial: "hidden", animate: "visible", exit: "hidden", transition: { duration }, style: { display: getDisplayValue() } }, child)));
|
|
56
|
-
function getDisplayValue() {
|
|
57
|
-
if (ref === null || ref === void 0 ? void 0 : ref.firstElementChild) {
|
|
58
|
-
return window.getComputedStyle(ref.firstElementChild).display;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function getChildData() {
|
|
62
|
-
let data = { key: `${initialChild.type}_1`, child: initialChild };
|
|
63
|
-
if (switched) {
|
|
64
|
-
data = { key: `${switchTo.type}_2`, child: switchTo };
|
|
65
|
-
}
|
|
66
|
-
return Object.assign(Object.assign({}, data), { transition: getTransitionType(), duration: getTransitionDuration() });
|
|
67
|
-
}
|
|
68
|
-
function getTransitionType() {
|
|
69
|
-
if (isSwitchingBetweenIcons) {
|
|
70
|
-
if (switched)
|
|
71
|
-
return SPIN_COUNTER_CLOCK_WISE;
|
|
72
|
-
return SPIN_CLOCK_WISE;
|
|
73
|
-
}
|
|
74
|
-
else if (type === "fade") {
|
|
75
|
-
return FADE;
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
if (switched)
|
|
79
|
-
return SLIDE_IN_UP;
|
|
80
|
-
return SLIDE_IN_DOWN;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function getTransitionDuration() {
|
|
84
|
-
switch (type) {
|
|
85
|
-
case "fade":
|
|
86
|
-
return DURATION_AVERAGE;
|
|
87
|
-
default:
|
|
88
|
-
return DURATION_SIMPLE;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
AnimatedSwitcher.Icon = function AnimatedSwitcherIcon({ switchToIcon, switched, initialIcon, }) {
|
|
93
|
-
return (React__default["default"].createElement(AnimatedSwitcher, { switched: switched, initialChild: React__default["default"].createElement(Icon.Icon, { name: initialIcon }), switchTo: React__default["default"].createElement(Icon.Icon, { name: switchToIcon }) }));
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
exports.AnimatedSwitcher = AnimatedSwitcher;
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var tslib_es6 = require('../tslib.es6-754e2961.js');
|
|
6
|
-
var React = require('react');
|
|
7
|
-
var debounce = require('lodash/debounce');
|
|
8
|
-
var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
|
|
9
|
-
var classnames = require('classnames');
|
|
10
|
-
var ReactDOM = require('react-dom');
|
|
11
|
-
var reactPopper = require('react-popper');
|
|
12
|
-
var useOnKeyDown = require('@jobber/hooks/useOnKeyDown');
|
|
13
|
-
var Text = require('../Text-259af966.js');
|
|
14
|
-
var Icon = require('../Icon-405a216c.js');
|
|
15
|
-
var Heading = require('../Heading-1e8e4bd3.js');
|
|
16
|
-
var InputText = require('../InputText-6e356985.js');
|
|
17
|
-
require('../Typography-c45bf216.js');
|
|
18
|
-
require('@jobber/design');
|
|
19
|
-
require('../getAtlantisConfig-0f3e8af2.js');
|
|
20
|
-
require('../FormField-b4e6c549.js');
|
|
21
|
-
require('uuid');
|
|
22
|
-
require('react-hook-form');
|
|
23
|
-
require('@jobber/hooks/useShowClear');
|
|
24
|
-
require('../Button-b73a5e01.js');
|
|
25
|
-
require('react-router-dom');
|
|
26
|
-
require('../InputValidation-05e839fa.js');
|
|
27
|
-
require('framer-motion');
|
|
28
|
-
require('../Spinner-9d8fc7ff.js');
|
|
29
|
-
|
|
30
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
31
|
-
|
|
32
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
33
|
-
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
34
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
35
|
-
|
|
36
|
-
var css_248z = ".v0Cys9vQ-NE- {\n position: relative;\n width: 100%;\n}\n\n.CX-N-e0e6og- {\n display: none;\n position: absolute;\n z-index: calc(6 + 1001);\n z-index: calc(var(--elevation-menu) + var(--elevation-modal));\n width: 100%;\n /* Unfortunately this is how we define our line item picker height in jobber online.\n This is a concession to maintain visual parity. */\n max-height: 300px;\n box-shadow: 0px calc(16px / 16) calc(16px / 4) 0px\n rgba(0, 0, 0, 0.1),\n 0px calc(16px / 4) 12px 0px rgba(0, 0, 0, 0.05);\n box-shadow: var(--shadow-base);\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: calc(16px / 16) solid var(--color-color-border);\n border: var(--border-base) solid var(--color-color-border);\n border-radius: calc(16px / 8);\n border-radius: var(--radius-base);\n overflow: auto;\n scroll-behavior: smooth;\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n.CX-N-e0e6og- h5 {\n padding: calc(16px / 2) 0 calc(16px / 4) calc(16px / 2);\n padding: var(--space-small) 0 var(--space-smaller) var(--space-small);\n border-bottom: calc(16px / 16) solid rgb(1, 41, 57);\n border-bottom: var(--border-base) solid var(--color-border--section);\n}\n\n.CX-N-e0e6og-._4PlUaegVpkk- {\n display: block;\n}\n\n.CX-N-e0e6og-._4PlUaegVpkk-:empty {\n display: none;\n}\n\n.ucQtG0iwqbo- {\n display: -ms-flexbox;\n display: flex;\n width: 100%;\n -ms-flex-direction: row;\n flex-direction: row;\n -ms-flex-wrap: nowrap;\n flex-wrap: nowrap;\n -ms-flex-pack: start;\n justify-content: flex-start;\n -ms-flex-line-pack: stretch;\n align-content: stretch;\n -ms-flex-align: center;\n align-items: center;\n padding: calc(16px / 2);\n padding: var(--space-small);\n border: none;\n text-align: left;\n list-style: none;\n background-color: transparent;\n cursor: pointer;\n transition: all 200ms;\n transition: all var(--timing-base);\n}\n\n.ucQtG0iwqbo-:hover,\n.ucQtG0iwqbo-:focus,\n.ucQtG0iwqbo-.r8HS-ma79QE- {\n background-color: rgb(244, 246, 250);\n background-color: var(--color-surface--hover);\n outline-color: rgb(147, 161, 169);\n outline-color: var(--color-focus);\n}\n\n.ucQtG0iwqbo-.ydwLX44YFZc-:not(:last-child) {\n border-bottom: calc(16px / 16) solid rgb(217, 223, 225);\n border-bottom: var(--border-base) solid var(--color-border);\n}\n\n.CX-N-e0e6og-:hover .ucQtG0iwqbo-.r8HS-ma79QE-:not(:hover) {\n background-color: transparent;\n outline-color: transparent;\n}\n\n.v0Cys9vQ-NE- .PvUgNoAUG7A-:not(:first-child) {\n padding-top: calc(16px / 2);\n padding-top: var(--space-small);\n}\n\n.ucQtG0iwqbo- .DAOOFUZ1BRM- {\n -ms-flex: 0 1 auto;\n flex: 0 1 auto;\n -ms-flex-item-align: auto;\n align-self: auto;\n width: calc(16px * 1.5);\n width: var(--space-large);\n}\n\n.ucQtG0iwqbo- .cjKJFup6hGY- {\n display: -ms-inline-flexbox;\n display: inline-flex;\n -ms-flex: 1 100%;\n flex: 1 100%;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n}\n\n.ucQtG0iwqbo- .hG5zNBuI2wA- {\n -ms-flex: 2;\n flex: 2;\n}\n\n.ucQtG0iwqbo- ._3CwjFCbhqi4- {\n -ms-flex: 1;\n flex: 1;\n -ms-flex-item-align: end;\n align-self: flex-end;\n text-align: right;\n}\n";
|
|
37
|
-
var styles = {"autocomplete":"v0Cys9vQ-NE-","options":"CX-N-e0e6og-","visible":"_4PlUaegVpkk-","option":"ucQtG0iwqbo-","active":"r8HS-ma79QE-","separator":"ydwLX44YFZc-","heading":"PvUgNoAUG7A-","icon":"DAOOFUZ1BRM-","text":"cjKJFup6hGY-","label":"hG5zNBuI2wA-","details":"_3CwjFCbhqi4-"};
|
|
38
|
-
styleInject_es.styleInject(css_248z);
|
|
39
|
-
|
|
40
|
-
var IndexChange;
|
|
41
|
-
(function (IndexChange) {
|
|
42
|
-
IndexChange[IndexChange["Previous"] = -1] = "Previous";
|
|
43
|
-
IndexChange[IndexChange["Next"] = 1] = "Next";
|
|
44
|
-
})(IndexChange || (IndexChange = {}));
|
|
45
|
-
function Menu({ visible, options, selectedOption, onOptionSelect, attachTo, }) {
|
|
46
|
-
const [highlightedIndex, setHighlightedIndex] = React.useState(0);
|
|
47
|
-
const { menuRef, setMenuRef, styles: popperStyles, attributes, targetWidth, } = useRepositionMenu(attachTo, visible);
|
|
48
|
-
const detectSeparatorCondition = (option) => option.description || option.details;
|
|
49
|
-
const detectGroups = (option) => option.options;
|
|
50
|
-
const addSeparators = options.some(detectSeparatorCondition);
|
|
51
|
-
const initialHighlight = options.some(detectGroups) ? 1 : 0;
|
|
52
|
-
setupKeyListeners();
|
|
53
|
-
React.useEffect(() => setHighlightedIndex(initialHighlight), [options]);
|
|
54
|
-
const menu = (React__default["default"].createElement("div", Object.assign({ className: classnames__default["default"](styles.options, { [styles.visible]: visible }), ref: setMenuRef, style: Object.assign(Object.assign({}, popperStyles.popper), { width: targetWidth }) }, attributes.popper), options.map((option, index) => {
|
|
55
|
-
const optionClass = classnames__default["default"](styles.option, {
|
|
56
|
-
[styles.active]: index === highlightedIndex,
|
|
57
|
-
[styles.separator]: addSeparators,
|
|
58
|
-
});
|
|
59
|
-
if (isGroup(option)) {
|
|
60
|
-
return (React__default["default"].createElement("div", { key: option.label, className: styles.heading },
|
|
61
|
-
React__default["default"].createElement(Heading.Heading, { level: 5 }, option.label)));
|
|
62
|
-
}
|
|
63
|
-
return (React__default["default"].createElement("button", { className: optionClass, key: option.value, onMouseDown: onOptionSelect.bind(undefined, option) },
|
|
64
|
-
React__default["default"].createElement("div", { className: styles.icon }, isOptionSelected(selectedOption, option) && (React__default["default"].createElement(Icon.Icon, { name: "checkmark", size: "small" }))),
|
|
65
|
-
React__default["default"].createElement("div", { className: styles.text },
|
|
66
|
-
React__default["default"].createElement("div", { className: styles.label },
|
|
67
|
-
React__default["default"].createElement(Text.Text, null, option.label),
|
|
68
|
-
option.description !== undefined && (React__default["default"].createElement(Text.Text, { variation: "subdued" }, option.description))),
|
|
69
|
-
option.details !== undefined && (React__default["default"].createElement("div", { className: styles.details },
|
|
70
|
-
React__default["default"].createElement(Text.Text, null, option.details))))));
|
|
71
|
-
})));
|
|
72
|
-
return ReactDOM.createPortal(menu, document.body);
|
|
73
|
-
function setupKeyListeners() {
|
|
74
|
-
React.useEffect(() => {
|
|
75
|
-
var _a, _b;
|
|
76
|
-
(_b = (_a = menuRef === null || menuRef === void 0 ? void 0 : menuRef.children[highlightedIndex]) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
77
|
-
behavior: "smooth",
|
|
78
|
-
block: "nearest",
|
|
79
|
-
inline: "start",
|
|
80
|
-
});
|
|
81
|
-
}, [highlightedIndex]);
|
|
82
|
-
useOnKeyDown.useOnKeyDown((event) => {
|
|
83
|
-
const indexChange = arrowKeyPress(event, IndexChange.Next);
|
|
84
|
-
if (indexChange) {
|
|
85
|
-
setHighlightedIndex(Math.min(options.length - 1, highlightedIndex + indexChange));
|
|
86
|
-
}
|
|
87
|
-
}, "ArrowDown");
|
|
88
|
-
useOnKeyDown.useOnKeyDown((event) => {
|
|
89
|
-
const indexChange = arrowKeyPress(event, IndexChange.Previous);
|
|
90
|
-
if (indexChange) {
|
|
91
|
-
setHighlightedIndex(Math.max(0, highlightedIndex + indexChange));
|
|
92
|
-
}
|
|
93
|
-
}, "ArrowUp");
|
|
94
|
-
useOnKeyDown.useOnKeyDown((event) => {
|
|
95
|
-
if (!visible)
|
|
96
|
-
return;
|
|
97
|
-
if (isGroup(options[highlightedIndex]))
|
|
98
|
-
return;
|
|
99
|
-
event.preventDefault();
|
|
100
|
-
onOptionSelect(options[highlightedIndex]);
|
|
101
|
-
}, "Enter");
|
|
102
|
-
}
|
|
103
|
-
function arrowKeyPress(event, direction) {
|
|
104
|
-
if (!visible)
|
|
105
|
-
return;
|
|
106
|
-
event.preventDefault();
|
|
107
|
-
const requestedIndex = options[highlightedIndex + direction];
|
|
108
|
-
return requestedIndex && isGroup(requestedIndex)
|
|
109
|
-
? direction + direction
|
|
110
|
-
: direction;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function isOptionSelected(selectedOption, option) {
|
|
114
|
-
return selectedOption && selectedOption.value === option.value;
|
|
115
|
-
}
|
|
116
|
-
function isGroup(option) {
|
|
117
|
-
if (option.options)
|
|
118
|
-
return true;
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
function useRepositionMenu(attachTo, visible = false) {
|
|
122
|
-
var _a;
|
|
123
|
-
const [menuRef, setMenuRef] = React.useState();
|
|
124
|
-
const popper = reactPopper.usePopper(attachTo.current, menuRef, {
|
|
125
|
-
modifiers: [
|
|
126
|
-
{ name: "offset", options: { offset: [0, 8] } },
|
|
127
|
-
{ name: "flip", options: { fallbackPlacements: ["top"] } },
|
|
128
|
-
],
|
|
129
|
-
});
|
|
130
|
-
React.useLayoutEffect(() => {
|
|
131
|
-
var _a;
|
|
132
|
-
(_a = popper === null || popper === void 0 ? void 0 : popper.update) === null || _a === void 0 ? void 0 : _a.call(popper);
|
|
133
|
-
}, [visible]);
|
|
134
|
-
const targetWidth = (_a = attachTo.current) === null || _a === void 0 ? void 0 : _a.clientWidth;
|
|
135
|
-
return Object.assign(Object.assign({}, popper), { menuRef, setMenuRef, targetWidth });
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Max statements increased to make room for the debounce functions
|
|
139
|
-
/* eslint max-statements: ["error", 14] */
|
|
140
|
-
function AutocompleteInternal(_a, ref) {
|
|
141
|
-
var _b;
|
|
142
|
-
var { initialOptions = [], value, allowFreeForm = true, size = undefined, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, validations } = _a, inputProps = tslib_es6.__rest(_a, ["initialOptions", "value", "allowFreeForm", "size", "debounce", "onChange", "getOptions", "placeholder", "onBlur", "onFocus", "validations"]);
|
|
143
|
-
const [options, setOptions] = React.useState(initialOptions);
|
|
144
|
-
const [menuVisible, setMenuVisible] = React.useState(false);
|
|
145
|
-
const [inputText, setInputText] = React.useState((_b = value === null || value === void 0 ? void 0 : value.label) !== null && _b !== void 0 ? _b : "");
|
|
146
|
-
const autocompleteRef = React.useRef(null);
|
|
147
|
-
const delayedSearch = debounce__default["default"](updateSearch, debounceRate);
|
|
148
|
-
React.useEffect(() => {
|
|
149
|
-
delayedSearch();
|
|
150
|
-
return delayedSearch.cancel;
|
|
151
|
-
}, [inputText]);
|
|
152
|
-
React.useEffect(() => {
|
|
153
|
-
var _a;
|
|
154
|
-
updateInput((_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : "");
|
|
155
|
-
}, [value]);
|
|
156
|
-
return (React__default["default"].createElement("div", { className: styles.autocomplete, ref: autocompleteRef },
|
|
157
|
-
React__default["default"].createElement(InputText.InputText, Object.assign({ ref: ref, autocomplete: false, size: size, value: inputText, onChange: handleInputChange, placeholder: placeholder, onFocus: handleInputFocus, onBlur: handleInputBlur, validations: validations }, inputProps)),
|
|
158
|
-
menuVisible && (React__default["default"].createElement(Menu, { attachTo: autocompleteRef, visible: menuVisible && options.length > 0, options: options, selectedOption: value, onOptionSelect: handleMenuChange }))));
|
|
159
|
-
function updateInput(newText) {
|
|
160
|
-
setInputText(newText);
|
|
161
|
-
if (newText === "") {
|
|
162
|
-
setOptions(mapToOptions(initialOptions));
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
function updateSearch() {
|
|
166
|
-
return tslib_es6.__awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
const updatedOptions = yield getOptions(inputText);
|
|
168
|
-
const filteredOptions = updatedOptions.filter((option) => "options" in option && option.options ? option.options.length > 0 : true);
|
|
169
|
-
setOptions(mapToOptions(filteredOptions));
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
function handleMenuChange(chosenOption) {
|
|
173
|
-
onChange(chosenOption);
|
|
174
|
-
updateInput(chosenOption.label);
|
|
175
|
-
setMenuVisible(false);
|
|
176
|
-
}
|
|
177
|
-
function handleInputChange(newText) {
|
|
178
|
-
updateInput(newText);
|
|
179
|
-
if (allowFreeForm) {
|
|
180
|
-
onChange({ label: newText });
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
function handleInputBlur() {
|
|
184
|
-
setMenuVisible(false);
|
|
185
|
-
if (value == undefined || value.label !== inputText) {
|
|
186
|
-
setInputText("");
|
|
187
|
-
onChange(undefined);
|
|
188
|
-
}
|
|
189
|
-
onBlur && onBlur();
|
|
190
|
-
}
|
|
191
|
-
function handleInputFocus() {
|
|
192
|
-
setMenuVisible(true);
|
|
193
|
-
if (onFocus) {
|
|
194
|
-
onFocus();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
function mapToOptions(items) {
|
|
199
|
-
return items.reduce(function (result, item) {
|
|
200
|
-
result = result.concat([item]);
|
|
201
|
-
if (item.options) {
|
|
202
|
-
result = result.concat(item.options);
|
|
203
|
-
}
|
|
204
|
-
return result;
|
|
205
|
-
}, []);
|
|
206
|
-
}
|
|
207
|
-
const Autocomplete = React.forwardRef(AutocompleteInternal);
|
|
208
|
-
|
|
209
|
-
exports.Autocomplete = Autocomplete;
|
package/dist/Avatar/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var Avatar = require('../Avatar-76a799fa.js');
|
|
6
|
-
require('react');
|
|
7
|
-
require('classnames');
|
|
8
|
-
require('../style-inject.es-9d2f5f4e.js');
|
|
9
|
-
require('color');
|
|
10
|
-
require('../Icon-405a216c.js');
|
|
11
|
-
require('@jobber/design');
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports.Avatar = Avatar.Avatar;
|