@jobber/components 4.67.2-JOB-84261.6 → 4.67.2-pre.25

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.
Files changed (154) hide show
  1. package/dist/AnimatedSwitcher/index.js +2 -2
  2. package/dist/{AnimatedSwitcher-d1e1ddcf.js → AnimatedSwitcher-879d0d6f.js} +1 -1
  3. package/dist/Autocomplete/index.js +13 -15
  4. package/dist/Avatar/index.js +2 -3
  5. package/dist/{Avatar-76a799fa.js → Avatar-765d6e45.js} +1 -4
  6. package/dist/Banner/index.js +4 -9
  7. package/dist/Button/index.js +3 -4
  8. package/dist/Button-8bde6560.js +54 -0
  9. package/dist/ButtonDismiss/index.js +4 -5
  10. package/dist/{ButtonDismiss-2b98d075.js → ButtonDismiss-af17d76d.js} +1 -1
  11. package/dist/Card/index.js +7 -8
  12. package/dist/Card-9dfc98d3.js +88 -0
  13. package/dist/Checkbox/index.js +5 -7
  14. package/dist/{Checkbox-ad7ec2e7.js → Checkbox-2d7c43d9.js} +5 -8
  15. package/dist/Chip/index.js +8 -7
  16. package/dist/Chip-dca6c22b.js +86 -0
  17. package/dist/Chips/index.js +12 -16
  18. package/dist/ClientOnly-4f3e136d.js +23 -0
  19. package/dist/Combobox/index.js +11 -10
  20. package/dist/{Combobox-eb1e5817.js → Combobox-35a3ea22.js} +43 -24
  21. package/dist/ConfirmationModal/index.js +14 -13
  22. package/dist/{ConfirmationModal-0f85d96c.js → ConfirmationModal-f6c0afc7.js} +3 -3
  23. package/dist/Content/index.js +1 -2
  24. package/dist/{Content-2ca1ffe1.js → Content-80486307.js} +0 -5
  25. package/dist/DataDump/index.js +9 -10
  26. package/dist/DataList/components/DataListHeader/DataListHeaderCheckbox.d.ts +1 -2
  27. package/dist/DataList/components/DataListHeaderTile/DataListSortingArrows.d.ts +1 -1
  28. package/dist/DataList/hooks/useMediaQuery.d.ts +3 -1
  29. package/dist/DataList/index.js +31 -56
  30. package/dist/DataTable/DataTable.d.ts +1 -1
  31. package/dist/DataTable/index.js +18 -22
  32. package/dist/DatePicker/index.js +4 -5
  33. package/dist/DatePicker-9399cc69.js +131 -0
  34. package/dist/DescriptionList/index.js +1 -4
  35. package/dist/Disclosure/index.js +2 -5
  36. package/dist/Divider/index.js +0 -3
  37. package/dist/Drawer/index.js +5 -10
  38. package/dist/Emphasis/index.js +2 -3
  39. package/dist/{Emphasis-b2d1b3aa.js → Emphasis-7a2893bb.js} +1 -1
  40. package/dist/FeatureSwitch/index.js +11 -13
  41. package/dist/Flex/index.js +6 -4
  42. package/dist/Form/index.js +1 -1
  43. package/dist/FormField/FormFieldTypes.d.ts +8 -0
  44. package/dist/FormField/FormFieldWrapper.d.ts +3 -1
  45. package/dist/FormField/components/ClearAction.d.ts +9 -0
  46. package/dist/FormField/index.js +9 -10
  47. package/dist/FormField-18eda132.js +252 -0
  48. package/dist/FormatDate/index.js +1 -1
  49. package/dist/FormatEmail/index.js +0 -3
  50. package/dist/FormatFile/index.js +17 -17
  51. package/dist/FormatFile-317b158a.js +116 -0
  52. package/dist/FormatTime/FormatTime.d.ts +1 -2
  53. package/dist/FormatTime/index.js +11 -6
  54. package/dist/Gallery/index.js +18 -20
  55. package/dist/Glimmer/index.js +3 -4
  56. package/dist/Glimmer-f5c31401.js +68 -0
  57. package/dist/Grid/index.js +0 -7
  58. package/dist/Heading/index.js +2 -3
  59. package/dist/{Heading-0f4ecb0c.js → Heading-f066883a.js} +1 -1
  60. package/dist/Icon/index.js +1 -1
  61. package/dist/InlineLabel/index.js +2 -3
  62. package/dist/InlineLabel-4c2fec47.js +25 -0
  63. package/dist/InputAvatar/index.js +8 -12
  64. package/dist/InputDate/InputDate.d.ts +1 -1
  65. package/dist/InputDate/index.js +10 -11
  66. package/dist/InputEmail/index.js +9 -10
  67. package/dist/InputFile/InputFile.d.ts +5 -1
  68. package/dist/InputFile/index.js +6 -8
  69. package/dist/{InputFile-540c1657.js → InputFile-5c44f0b4.js} +8 -11
  70. package/dist/InputGroup/index.js +1 -2
  71. package/dist/InputGroup-88bec8c9.js +30 -0
  72. package/dist/InputNumber/index.js +10 -11
  73. package/dist/{InputNumber-d9ebabaa.js → InputNumber-ed655bae.js} +1 -1
  74. package/dist/InputPassword/index.js +9 -10
  75. package/dist/InputPhoneNumber/index.js +9 -12
  76. package/dist/InputText/InputText.d.ts +2 -0
  77. package/dist/InputText/index.js +11 -11
  78. package/dist/InputText/useSafeLayoutEffect.d.ts +2 -0
  79. package/dist/{InputText-f7c45ee5.js → InputText-c68964ff.js} +3 -2
  80. package/dist/InputTime/InputTime.d.ts +3 -1
  81. package/dist/InputTime/InputTime.disabledTest.d.ts +1 -0
  82. package/dist/InputTime/InputTimeProps.d.ts +1 -1
  83. package/dist/InputTime/InternalInputTime.d.ts +3 -0
  84. package/dist/InputTime/SupportsTimePolyfill.d.ts +2 -0
  85. package/dist/InputTime/TimeInputPolyfill.client.d.ts +2 -0
  86. package/dist/InputTime/index.js +58 -724
  87. package/dist/InputValidation/index.js +4 -5
  88. package/dist/{InputValidation-179f0926.js → InputValidation-fdc891af.js} +2 -5
  89. package/dist/LightBox/ClientOnly.d.ts +6 -0
  90. package/dist/LightBox/LightBox.d.ts +2 -2
  91. package/dist/LightBox/index.js +6 -6
  92. package/dist/{LightBox-3f4dbc33.js → LightBox-d5aea313.js} +5 -6
  93. package/dist/List/index.js +9 -15
  94. package/dist/Markdown/Markdown.d.ts +1 -1
  95. package/dist/Markdown/index.js +8 -8
  96. package/dist/Markdown-10fc9d3e.js +90 -0
  97. package/dist/Menu/Menu.d.ts +4 -4
  98. package/dist/Menu/index.js +5 -6
  99. package/dist/{Menu-d7ea093c.js → Menu-7b7aa325.js} +7 -10
  100. package/dist/Modal/Modal.d.ts +2 -2
  101. package/dist/Modal/index.js +7 -7
  102. package/dist/{Modal-70daa0e2.js → Modal-357fd1df.js} +6 -9
  103. package/dist/MultiSelect/index.js +5 -11
  104. package/dist/{Option-469029b5.js → Option-c84f28a6.js} +1 -1
  105. package/dist/Page/index.js +12 -14
  106. package/dist/Popover/Popover.d.ts +2 -2
  107. package/dist/Popover/index.js +8 -8
  108. package/dist/ProgressBar/index.js +1 -2
  109. package/dist/ProgressBar-5c577dc0.js +38 -0
  110. package/dist/RadioGroup/index.js +3 -5
  111. package/dist/RadioGroup-9dded55d.js +44 -0
  112. package/dist/RecurringSelect/components/DayOfMonthSelect.d.ts +2 -2
  113. package/dist/RecurringSelect/components/WeeklySelect.d.ts +2 -2
  114. package/dist/RecurringSelect/index.js +16 -29
  115. package/dist/Select/index.js +10 -11
  116. package/dist/Spinner/index.js +1 -2
  117. package/dist/Spinner-cac356ee.js +21 -0
  118. package/dist/StatusLabel/index.js +2 -5
  119. package/dist/SupportsTimePolyfill-466a30f9.js +21 -0
  120. package/dist/Switch/index.js +2 -3
  121. package/dist/Switch-588c5e70.js +53 -0
  122. package/dist/Table/index.js +0 -5
  123. package/dist/Tabs/index.js +1 -4
  124. package/dist/Text/index.js +2 -3
  125. package/dist/{Text-4a2bc89f.js → Text-9f261dde.js} +1 -1
  126. package/dist/TimeInputPolyfill.client-1dfc8ab1.js +687 -0
  127. package/dist/Toast/index.js +3 -6
  128. package/dist/Tooltip/index.js +3 -2
  129. package/dist/{Tooltip-6b12f1c2.js → Tooltip-99440954.js} +14 -12
  130. package/dist/Typography/index.js +1 -2
  131. package/dist/Typography-75f58b60.js +43 -0
  132. package/dist/styles.css +8107 -0
  133. package/dist/useSafeLayoutEffect-b63708b1.js +16 -0
  134. package/package.json +4 -4
  135. package/rollup.config.js +3 -1
  136. package/dist/Button-163a0641.js +0 -57
  137. package/dist/Card-3178033c.js +0 -93
  138. package/dist/Chip-168acf3e.js +0 -89
  139. package/dist/DatePicker-c18f1739.js +0 -134
  140. package/dist/FormField-dfc061ca.js +0 -227
  141. package/dist/FormatFile-3b650d02.js +0 -121
  142. package/dist/Glimmer-cfa92a88.js +0 -77
  143. package/dist/InlineLabel-9a517c19.js +0 -28
  144. package/dist/InputGroup-8d4fd4eb.js +0 -33
  145. package/dist/Markdown-96070121.js +0 -62
  146. package/dist/ProgressBar-b68edc8f.js +0 -43
  147. package/dist/RadioGroup-ebaa4f87.js +0 -47
  148. package/dist/Spinner-9d8fc7ff.js +0 -24
  149. package/dist/Switch-b85272bf.js +0 -56
  150. package/dist/Typography-973b122e.js +0 -62
  151. package/dist/style-inject.es-9d2f5f4e.js +0 -30
  152. /package/dist/{FormatDate-70ea5b43.js → FormatDate-6fc94218.js} +0 -0
  153. /package/dist/{Icon-405a216c.js → Icon-361343e0.js} +0 -0
  154. /package/dist/{tslib.es6-5b8768b7.js → tslib.es6-a575af05.js} +0 -0
@@ -4,13 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var classnames = require('classnames');
7
- var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
8
- var Heading = require('../Heading-0f4ecb0c.js');
9
- var ButtonDismiss = require('../ButtonDismiss-2b98d075.js');
10
- require('../Typography-973b122e.js');
11
- require('../Button-163a0641.js');
7
+ var Heading = require('../Heading-f066883a.js');
8
+ var ButtonDismiss = require('../ButtonDismiss-af17d76d.js');
9
+ require('../Typography-75f58b60.js');
10
+ require('../Button-8bde6560.js');
12
11
  require('react-router-dom');
13
- require('../Icon-405a216c.js');
12
+ require('../Icon-361343e0.js');
14
13
  require('@jobber/design');
15
14
 
16
15
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -18,9 +17,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
18
17
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
19
18
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
20
19
 
21
- var css_248z$1 = ":root {\n --drawer-width: calc(var(--space-base) * 17.5);\n --drawer--base-padding: var(--space-base);\n}\n\n.IJAyrFb2GpA- {\n display: none;\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 1001;\n z-index: var(--elevation-modal);\n overflow: hidden;\n\n /* SPECIAL CASE:\n Drawer is primarily used in Jobber Online and is currently used in a layout\n that rearranges at 640px. For compatibility, this is hardcoded here\n rather than using the breakpoint custom properties.\n DO NOT COPY THIS - USE THE BREAKPOINTS DEFINED IN THE @jobber/design package!\n */\n}\n\n@media (min-width: 640px), print {\n\n.IJAyrFb2GpA- {\n position: relative;\n z-index: auto;\n width: calc((16px * 1) * 17.5);\n width: calc(calc(16px * 1) * 17.5);\n width: var(--drawer-width);\n}\n }\n\n@media (min-width: 1080px) {\n\n.IJAyrFb2GpA- {\n --drawer-width: calc(var(--space-base) * 26.25);\n}\n }\n\n@media (--large-screens-and-up) {\n\n.IJAyrFb2GpA- {\n --drawer-width: calc(var(--space-base) * 26.25);\n}\n }\n\n.Hsmk6Pg14PQ- {\n display: -ms-flexbox;\n display: flex;\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n border: calc(16px / 16) solid rgb(217, 223, 225);\n border: var(--border-base) solid var(--color-border);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n -ms-flex-direction: column;\n flex-direction: column;\n}\n\n.DwF3Q9EMPvQ- {\n display: -ms-flexbox;\n display: flex;\n}\n\n.TcdyXiTbnMU- {\n display: -ms-flexbox;\n display: flex;\n padding: calc(16px / 2) calc(16px * 1);\n padding: var(--space-small) var(--drawer--base-padding);\n background-color: rgb(238, 240, 242);\n background-color: var(--color-surface--background);\n -ms-flex-pack: justify;\n justify-content: space-between;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.srL7xqEzwhM- {\n display: -ms-flexbox;\n display: flex;\n width: 100%;\n height: 100%;\n -ms-flex-direction: row;\n flex-direction: row;\n overflow-y: auto;\n}\n\n.p6-yqttoIJI- {\n width: 100%;\n}\n\n/* Adjust `Content` components public padding to match the cards */\n\n.p6-yqttoIJI- > * {\n --public-content--padding: var(--drawer--base-padding);\n}\n\n/* Remove the nested `Content` components public padding */\n\n.p6-yqttoIJI- > * > * {\n --public-content--padding: 0;\n}\n";
22
20
  var styles$1 = {"container":"IJAyrFb2GpA-","drawer":"Hsmk6Pg14PQ-","open":"DwF3Q9EMPvQ-","header":"TcdyXiTbnMU-","contentScroll":"srL7xqEzwhM-","content":"p6-yqttoIJI-"};
23
- styleInject_es.styleInject(css_248z$1);
24
21
 
25
22
  function Drawer({ title, children, open = true, onRequestClose, id, }) {
26
23
  const drawerClassNames = classnames__default["default"](styles$1.container, open && styles$1.open);
@@ -37,9 +34,7 @@ function Header({ title, onRequestClose }) {
37
34
  React__default["default"].createElement(ButtonDismiss.ButtonDismiss, { onClick: onRequestClose, ariaLabel: `Close ${title || "drawer"}` })));
38
35
  }
39
36
 
40
- var css_248z = "._50Jq09W07gg- {\n display: grid;\n width: 100%;\n height: 100%;\n overflow: hidden;\n grid-template-columns: minmax(0, 1fr) minmax(-webkit-min-content, -webkit-max-content);\n grid-template-columns: minmax(0, 1fr) minmax(min-content, max-content);\n grid-template-rows: 1fr;\n}\n";
41
37
  var styles = {"drawerGrid":"_50Jq09W07gg-"};
42
- styleInject_es.styleInject(css_248z);
43
38
 
44
39
  function DrawerGrid({ children }) {
45
40
  return React__default["default"].createElement("div", { className: styles.drawerGrid }, children);
@@ -2,11 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var Emphasis = require('../Emphasis-b2d1b3aa.js');
5
+ var Emphasis = require('../Emphasis-7a2893bb.js');
6
6
  require('react');
7
- require('../Typography-973b122e.js');
7
+ require('../Typography-75f58b60.js');
8
8
  require('classnames');
9
- require('../style-inject.es-9d2f5f4e.js');
10
9
 
11
10
 
12
11
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var Typography = require('./Typography-973b122e.js');
4
+ var Typography = require('./Typography-75f58b60.js');
5
5
 
6
6
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
7
7
 
@@ -5,28 +5,26 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var React = require('react');
6
6
  var framerMotion = require('framer-motion');
7
7
  var classnames = require('classnames');
8
- var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
9
- var Heading = require('../Heading-0f4ecb0c.js');
10
- var Text = require('../Text-4a2bc89f.js');
11
- var Content = require('../Content-2ca1ffe1.js');
12
- var Switch = require('../Switch-b85272bf.js');
13
- var Button = require('../Button-163a0641.js');
14
- var Emphasis = require('../Emphasis-b2d1b3aa.js');
15
- var Markdown = require('../Markdown-96070121.js');
16
- require('../Typography-973b122e.js');
8
+ var Heading = require('../Heading-f066883a.js');
9
+ var Text = require('../Text-9f261dde.js');
10
+ var Content = require('../Content-80486307.js');
11
+ var Switch = require('../Switch-588c5e70.js');
12
+ var Button = require('../Button-8bde6560.js');
13
+ var Emphasis = require('../Emphasis-7a2893bb.js');
14
+ var Markdown = require('../Markdown-10fc9d3e.js');
15
+ require('../Typography-75f58b60.js');
17
16
  require('react-router-dom');
18
- require('../Icon-405a216c.js');
17
+ require('../Icon-361343e0.js');
19
18
  require('@jobber/design');
20
- require('react-markdown');
19
+ require('../tslib.es6-a575af05.js');
20
+ require('markdown-to-jsx');
21
21
 
22
22
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
23
23
 
24
24
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
25
25
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
26
26
 
27
- var css_248z = ".-sVnhIK4hZw- {\n display: -ms-flexbox;\n display: flex;\n}\n\n.ZJaXf-cIFgU- {\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n -ms-flex-item-align: center;\n align-self: center;\n padding-right: calc(16px * 1);\n padding-right: var(--space-base);\n transition: opacity 200ms;\n transition: opacity var(--timing-base);\n}\n\n.OA-s1YYLMMM- {\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.lN90IIewHq8- {\n position: absolute;\n top: 100%;\n width: 100%;\n margin-top: calc(16px / 8);\n margin-top: var(--space-smallest);\n text-align: center;\n}\n\n.mW56hvBHqPM- {\n opacity: 0.5;\n}\n\n.QfZjM5S-Ls0- {\n opacity: 1;\n}\n";
28
27
  var styles = {"container":"-sVnhIK4hZw-","content":"ZJaXf-cIFgU-","action":"OA-s1YYLMMM-","savedIndicator":"lN90IIewHq8-","featureContent":"mW56hvBHqPM-","enabled":"QfZjM5S-Ls0-"};
29
- styleInject_es.styleInject(css_248z);
30
28
 
31
29
  function FeatureSwitch({ children, description, disabled = false, enabled, externalLink = false, onEdit, onSwitch, hasSaveIndicator = false, title, }) {
32
30
  const [savedIndicator, setSavedIndicator] = React.useState(false);
@@ -4,22 +4,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var classnames = require('classnames');
7
- var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
7
+ var useSafeLayoutEffect = require('../useSafeLayoutEffect-b63708b1.js');
8
8
 
9
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
10
 
11
11
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
12
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
13
13
 
14
- var css_248z = "._8VpnrMKmsqQ- {\n display: grid;\n /* If this gets wrapped in a flex container, it should take the remaining space */\n -ms-flex: 1;\n flex: 1;\n}\n\n.ooF1YfV4Usc- {\n gap: calc(16px / 8);\n gap: var(--space-smallest);\n}\n\n.ppCZfXq-Kqc- {\n gap: calc(16px / 4);\n gap: var(--space-smaller);\n}\n\n.tElkBalXH3g- {\n gap: calc(16px / 2);\n gap: var(--space-small);\n}\n\n._4u3OwUKxxbg- {\n gap: calc(16px * 1);\n gap: var(--space-base);\n}\n\n.RL7CJla0AAI- {\n gap: calc(16px * 1.5);\n gap: var(--space-large);\n}\n\n.fV4cvFYkhgo- {\n gap: 0;\n}\n\n._04xVVjZgr-0- {\n -ms-flex-align: start;\n align-items: start;\n}\n\n.Nc3zrqHHYSg- {\n -ms-flex-align: center;\n align-items: center;\n}\n\n.qA-v50wBX1U- {\n -ms-flex-align: end;\n align-items: end;\n}\n";
15
14
  var styles = {"flexible":"_8VpnrMKmsqQ-","smallestGap":"ooF1YfV4Usc-","smallerGap":"ppCZfXq-Kqc-","smallGap":"tElkBalXH3g-","baseGap":"_4u3OwUKxxbg-","largeGap":"RL7CJla0AAI-","noneGap":"fV4cvFYkhgo-","startAlign":"_04xVVjZgr-0-","centerAlign":"Nc3zrqHHYSg-","endAlign":"qA-v50wBX1U-"};
16
- styleInject_es.styleInject(css_248z);
17
15
 
18
16
  function Flex({ align = "center", children, direction = "row", gap = "base", template, }) {
17
+ const [style, setStyle] = React__default["default"].useState({});
18
+ useSafeLayoutEffect.useSafeLayoutEffect(() => {
19
+ setStyle(generateGridStylesFromTemplate(direction, template));
20
+ }, [direction, template]);
19
21
  return (React__default["default"].createElement("div", { className: classnames__default["default"](styles.flexible, {
20
22
  [styles[`${gap}Gap`]]: Boolean(gap),
21
23
  [styles[`${align}Align`]]: Boolean(align),
22
- }), style: generateGridStylesFromTemplate(direction, template) }, children));
24
+ }), style: style }, children));
23
25
  }
24
26
  function generateGridStylesFromTemplate(direction, layoutTemplate) {
25
27
  const containerStyles = {};
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var tslib_es6 = require('../tslib.es6-5b8768b7.js');
5
+ var tslib_es6 = require('../tslib.es6-a575af05.js');
6
6
  var React = require('react');
7
7
  var reactHookForm = require('react-hook-form');
8
8
 
@@ -74,6 +74,14 @@ export interface CommonFormFieldProps {
74
74
  * Set the component to the given value.
75
75
  */
76
76
  readonly value?: string | number | Date;
77
+ /**
78
+ * Add a clear action on the input that clears the value.
79
+ *
80
+ * You should always use `while-editing` if you want the input to be
81
+ * clearable. if the input value isn't editable (i.e. `InputTime`) you can
82
+ * set it to `always`.
83
+ */
84
+ readonly clearable?: "never" | "always";
77
85
  }
78
86
  export interface FormFieldProps extends CommonFormFieldProps {
79
87
  actionsRef?: RefObject<FieldActionsRef>;
@@ -4,6 +4,8 @@ interface FormFieldWrapperProps extends FormFieldProps {
4
4
  readonly error: string;
5
5
  readonly identifier: string;
6
6
  readonly descriptionIdentifier: string;
7
+ readonly clearable: "never" | "always";
8
+ readonly onClear: () => void;
7
9
  }
8
- export declare function FormFieldWrapper({ align, description, descriptionIdentifier, placeholder, value, children, invalid, error, size, prefix, suffix, max, maxLength, type, disabled, inline, identifier, }: PropsWithChildren<FormFieldWrapperProps>): JSX.Element;
10
+ export declare function FormFieldWrapper({ align, description, descriptionIdentifier, placeholder, value, children, invalid, error, size, prefix, suffix, max, maxLength, type, disabled, inline, identifier, clearable, onClear, }: PropsWithChildren<FormFieldWrapperProps>): JSX.Element;
9
11
  export {};
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ interface ClearActionProps {
3
+ /**
4
+ * Click handler
5
+ */
6
+ readonly onClick: () => void;
7
+ }
8
+ export declare function ClearAction({ onClick }: ClearActionProps): JSX.Element;
9
+ export {};
@@ -2,22 +2,21 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var FormField = require('../FormField-dfc061ca.js');
6
- require('../tslib.es6-5b8768b7.js');
5
+ var FormField = require('../FormField-18eda132.js');
6
+ require('../tslib.es6-a575af05.js');
7
7
  require('react');
8
- require('uuid');
9
8
  require('react-hook-form');
10
- require('../style-inject.es-9d2f5f4e.js');
11
9
  require('classnames');
12
- require('../Button-163a0641.js');
10
+ require('@jobber/hooks/useShowClear');
11
+ require('../Button-8bde6560.js');
13
12
  require('react-router-dom');
14
- require('../Icon-405a216c.js');
13
+ require('../Icon-361343e0.js');
15
14
  require('@jobber/design');
16
- require('../Typography-973b122e.js');
17
- require('../Text-4a2bc89f.js');
18
- require('../InputValidation-179f0926.js');
15
+ require('../Typography-75f58b60.js');
16
+ require('../Text-9f261dde.js');
17
+ require('../InputValidation-fdc891af.js');
19
18
  require('framer-motion');
20
- require('../Spinner-9d8fc7ff.js');
19
+ require('../Spinner-cac356ee.js');
21
20
 
22
21
 
23
22
 
@@ -0,0 +1,252 @@
1
+ 'use strict';
2
+
3
+ var tslib_es6 = require('./tslib.es6-a575af05.js');
4
+ var React = require('react');
5
+ var reactHookForm = require('react-hook-form');
6
+ var classnames = require('classnames');
7
+ var useShowClear = require('@jobber/hooks/useShowClear');
8
+ var Button = require('./Button-8bde6560.js');
9
+ var Icon = require('./Icon-361343e0.js');
10
+ var Text = require('./Text-9f261dde.js');
11
+ var InputValidation = require('./InputValidation-fdc891af.js');
12
+ var Spinner = require('./Spinner-cac356ee.js');
13
+
14
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
+
16
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
17
+ var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
18
+
19
+ var styles$1 = {"container":"geR7qBhrMfk-","wrapper":"nPGhTEEzsoU-","timeInputLabel":"YhserUiOeFE-","miniLabel":"UIZq8hTmJVU-","large":"Ku8sWS0mLew-","textarea":"mgPacJ6Z71Y-","invalid":"gJ-15M615eY-","disabled":"_1rsTLm5GwcM-","small":"o8D-H-lKfDk-","inline":"_5Hu2F3cBvng-","center":"s1WLQs6ffD8-","right":"a2r4QheWYIA-","maxLength":"KdAnXK1gClo-","inputWrapper":"iQFhpFYnz-8-","childrenWrapper":"Yo2Wi9dpa-Y-","input":"LSHPV7PwOTg-","select":"i31GQXcMz54-","label":"_3xREbTN5pPg-","postfix":"VtnAk1HYMMk-","affixIcon":"uPLklxvtfJw-","suffix":"pYqqDvv57JE-","hasAction":"eI44oQpuVlk-","affixLabel":"jO8P2iSHilM-","description":"_2GfgzNnLOSI-"};
20
+
21
+ function AffixLabel({ label, variation = "prefix", labelRef, }) {
22
+ const affixLabelClass = classnames__default["default"](styles$1.affixLabel, {
23
+ [styles$1.suffix]: variation === "suffix",
24
+ });
25
+ return (React__default["default"].createElement("div", { ref: labelRef, className: affixLabelClass }, label));
26
+ }
27
+ function AffixIcon({ icon, onClick, ariaLabel, variation = "prefix", size, }) {
28
+ const affixIconClass = classnames__default["default"](styles$1.affixIcon, {
29
+ [styles$1.suffix]: variation === "suffix",
30
+ [styles$1.hasAction]: onClick,
31
+ });
32
+ const iconSize = size === "small" ? "small" : "base";
33
+ if (!icon)
34
+ return React__default["default"].createElement(React__default["default"].Fragment, null);
35
+ return (React__default["default"].createElement("div", { className: affixIconClass }, onClick ? (React__default["default"].createElement(Button.Button
36
+ /**
37
+ * We can cast the ariaLabel here as a `Suffix`
38
+ * requires an ariaLabel if there is an action
39
+ */
40
+ , {
41
+ /**
42
+ * We can cast the ariaLabel here as a `Suffix`
43
+ * requires an ariaLabel if there is an action
44
+ */
45
+ ariaLabel: ariaLabel, icon: icon, onClick: onClick, variation: "subtle", type: "tertiary", size: iconSize })) : (React__default["default"].createElement(Icon.Icon, { name: icon, size: iconSize, color: "greyBlue" }))));
46
+ }
47
+
48
+ function FormFieldDescription({ id, description, }) {
49
+ return (React__default["default"].createElement("div", { id: id, className: styles$1.description },
50
+ React__default["default"].createElement(Text.Text, { size: "small", variation: "subdued" }, description)));
51
+ }
52
+
53
+ var styles = {"clearContainer":"_07kZJ5ltI5E-","clearInput":"t1fFX8kDJh8-"};
54
+
55
+ function ClearAction({ onClick }) {
56
+ return (React__default["default"].createElement("div", { className: styles.clearContainer },
57
+ React__default["default"].createElement("button", { className: styles.clearInput, onClick: onClick, type: "button", "aria-label": "Clear input" },
58
+ React__default["default"].createElement(Icon.Icon, { name: "remove", size: "small" }))));
59
+ }
60
+
61
+ function FormFieldWrapper({ align, description, descriptionIdentifier, placeholder, value, children, invalid, error, size, prefix, suffix, max, maxLength, type, disabled, inline, identifier, clearable, onClear, }) {
62
+ const wrapperClasses = classnames__default["default"](styles$1.wrapper, size && styles$1[size], align && styles$1[align], {
63
+ [styles$1.miniLabel]: (placeholder && value !== "") ||
64
+ (placeholder && type === "select") ||
65
+ // Naively assume that if the the type is tel, it is the InputPhoneNumber
66
+ (placeholder && type === "tel"),
67
+ [styles$1.textarea]: type === "textarea",
68
+ [styles$1.select]: type === "select",
69
+ [styles$1.invalid]: invalid !== null && invalid !== void 0 ? invalid : error,
70
+ [styles$1.disabled]: disabled,
71
+ [styles$1.maxLength]: maxLength,
72
+ [styles$1.timeInputLabel]: placeholder && type === "time" && placeholder && value === "",
73
+ });
74
+ const containerClasses = classnames__default["default"](styles$1.container, {
75
+ [styles$1.inline]: inline,
76
+ });
77
+ const wrapperInlineStyle = {
78
+ ["--formField-maxLength"]: maxLength || max,
79
+ };
80
+ const prefixRef = React.useRef();
81
+ const suffixRef = React.useRef();
82
+ const [labelStyle, setLabelStyle] = React.useState({
83
+ paddingLeft: undefined,
84
+ paddingRight: undefined,
85
+ });
86
+ React.useEffect(() => {
87
+ setLabelStyle(getAffixPaddding);
88
+ }, [value]);
89
+ const [focused, setFocused] = React.useState(false);
90
+ const showClear = useShowClear.useShowClear({
91
+ clearable,
92
+ multiline: type === "textarea",
93
+ focused,
94
+ hasValue: Boolean(value),
95
+ disabled,
96
+ });
97
+ return (React__default["default"].createElement("div", { className: containerClasses, onFocus: () => setFocused(true), onBlur: () => setFocused(false) },
98
+ React__default["default"].createElement("div", { className: wrapperClasses, style: wrapperInlineStyle, "data-testid": "Form-Field-Wrapper" },
99
+ (prefix === null || prefix === void 0 ? void 0 : prefix.icon) && React__default["default"].createElement(AffixIcon, Object.assign({}, prefix, { size: size })),
100
+ React__default["default"].createElement("div", { className: styles$1.inputWrapper },
101
+ placeholder && (React__default["default"].createElement("label", { className: styles$1.label, htmlFor: identifier, style: (prefixRef === null || prefixRef === void 0 ? void 0 : prefixRef.current) || (suffixRef === null || suffixRef === void 0 ? void 0 : suffixRef.current)
102
+ ? labelStyle
103
+ : undefined }, placeholder)),
104
+ (prefix === null || prefix === void 0 ? void 0 : prefix.label) && React__default["default"].createElement(AffixLabel, Object.assign({}, prefix, { labelRef: prefixRef })),
105
+ React__default["default"].createElement("div", { className: styles$1.childrenWrapper }, children)),
106
+ (suffix === null || suffix === void 0 ? void 0 : suffix.label) && (React__default["default"].createElement(AffixLabel, Object.assign({}, suffix, { labelRef: suffixRef, variation: "suffix" }))),
107
+ showClear && React__default["default"].createElement(ClearAction, { onClick: onClear }),
108
+ (suffix === null || suffix === void 0 ? void 0 : suffix.icon) && (React__default["default"].createElement(AffixIcon, Object.assign({}, suffix, { variation: "suffix", size: size })))),
109
+ description && !inline && (React__default["default"].createElement(FormFieldDescription, { id: descriptionIdentifier, description: description })),
110
+ error && !inline && React__default["default"].createElement(InputValidation.InputValidation, { message: error })));
111
+ function getAffixPaddding() {
112
+ const hasValue = value !== "";
113
+ const newPadding = {
114
+ paddingLeft: undefined,
115
+ paddingRight: undefined,
116
+ };
117
+ // Naively assume that if the the type is tel, it is the InputPhoneNumber
118
+ if (type === "tel")
119
+ return newPadding;
120
+ if ((prefixRef === null || prefixRef === void 0 ? void 0 : prefixRef.current) && !hasValue) {
121
+ const { offsetWidth } = prefixRef.current;
122
+ newPadding.paddingLeft = offset(offsetWidth);
123
+ }
124
+ if ((suffixRef === null || suffixRef === void 0 ? void 0 : suffixRef.current) && !hasValue) {
125
+ const { offsetWidth } = suffixRef.current;
126
+ newPadding.paddingRight = offset(offsetWidth);
127
+ }
128
+ function offset(width) {
129
+ return `calc(${width}px + var(--space-smallest)`;
130
+ }
131
+ return newPadding;
132
+ }
133
+ }
134
+
135
+ function FormFieldPostFix({ variation }) {
136
+ return (React__default["default"].createElement("span", { className: styles$1.postfix }, variation === "select" ? (React__default["default"].createElement(Icon.Icon, { name: "arrowDown" })) : (React__default["default"].createElement(Spinner.Spinner, { size: "small" }))));
137
+ }
138
+
139
+ function FormField(props) {
140
+ var _a, _b;
141
+ const { actionsRef, autocomplete = true, children, defaultValue, description, disabled, inputRef, inline, keyboard, max, maxLength, min, name, readonly, rows, loading, type = "text", validations, value, onChange, onEnter, onFocus, onBlur, onValidation, clearable = "never", } = props;
142
+ const { control, formState: { errors }, setValue, watch, } = reactHookForm.useFormContext() != undefined
143
+ ? reactHookForm.useFormContext()
144
+ : // If there isn't a Form Context being provided, get a form for this field.
145
+ reactHookForm.useForm({ mode: "onTouched" });
146
+ const { controlledName, identifier, descriptionIdentifier } = getNamesAndIds(name);
147
+ React.useEffect(() => {
148
+ if (value != undefined) {
149
+ setValue(controlledName, value);
150
+ }
151
+ }, [value, watch(controlledName)]);
152
+ React.useImperativeHandle(actionsRef, () => ({
153
+ setValue: newValue => {
154
+ setValue(controlledName, newValue, { shouldValidate: true });
155
+ },
156
+ }));
157
+ const message = (_a = errors[controlledName]) === null || _a === void 0 ? void 0 : _a.message;
158
+ const error = getErrorMessage();
159
+ React.useEffect(() => handleValidation(), [error]);
160
+ return (React__default["default"].createElement(reactHookForm.Controller, { control: control, name: controlledName, rules: Object.assign({}, validations), defaultValue: (_b = value !== null && value !== void 0 ? value : defaultValue) !== null && _b !== void 0 ? _b : "", render: (_a) => {
161
+ var _b = _a.field, { onChange: onControllerChange, onBlur: onControllerBlur, name: controllerName } = _b, rest = tslib_es6.__rest(_b, ["onChange", "onBlur", "name"]);
162
+ const fieldProps = Object.assign(Object.assign(Object.assign({}, rest), { id: identifier, className: styles$1.input, name: (validations || name) && controllerName, disabled: disabled, readOnly: readonly, inputMode: keyboard, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus }), (description &&
163
+ !inline && { "aria-describedby": descriptionIdentifier }));
164
+ const textFieldProps = Object.assign(Object.assign({}, fieldProps), { onKeyDown: handleKeyDown });
165
+ return (React__default["default"].createElement(FormFieldWrapper, Object.assign({}, props, { value: rest.value, error: error, identifier: identifier, descriptionIdentifier: descriptionIdentifier, clearable: clearable, onClear: handleClear }), renderField()));
166
+ function renderField() {
167
+ switch (type) {
168
+ case "select":
169
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
170
+ React__default["default"].createElement("select", Object.assign({}, fieldProps), children),
171
+ React__default["default"].createElement(FormFieldPostFix, { variation: "select" })));
172
+ case "textarea":
173
+ return (React__default["default"].createElement("textarea", Object.assign({}, textFieldProps, { rows: rows, ref: inputRef })));
174
+ default:
175
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
176
+ React__default["default"].createElement("input", Object.assign({}, textFieldProps, { autoComplete: setAutocomplete(autocomplete), type: type, maxLength: maxLength, max: max, min: min, ref: inputRef })),
177
+ loading && React__default["default"].createElement(FormFieldPostFix, { variation: "spinner" }),
178
+ children));
179
+ }
180
+ }
181
+ function handleClear() {
182
+ var _a;
183
+ handleBlur();
184
+ setValue(controlledName, undefined, { shouldValidate: true });
185
+ onChange && onChange("");
186
+ (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
187
+ }
188
+ function handleChange(event) {
189
+ let newValue;
190
+ newValue = event.currentTarget.value;
191
+ if (type === "number" && newValue.length > 0) {
192
+ newValue = parseFloat(newValue);
193
+ }
194
+ onChange && onChange(newValue, event);
195
+ onControllerChange(event);
196
+ }
197
+ function handleKeyDown(event) {
198
+ if (!onEnter)
199
+ return;
200
+ if (event.key !== "Enter")
201
+ return;
202
+ if (event.shiftKey || event.ctrlKey)
203
+ return;
204
+ event.preventDefault();
205
+ onEnter && onEnter(event);
206
+ }
207
+ function handleFocus(event) {
208
+ const target = event.currentTarget;
209
+ if (target.select) {
210
+ setTimeout(() => readonly && target.select());
211
+ }
212
+ onFocus && onFocus();
213
+ }
214
+ function handleBlur() {
215
+ onBlur && onBlur();
216
+ onControllerBlur();
217
+ }
218
+ } }));
219
+ function getErrorMessage() {
220
+ if (typeof message === "string") {
221
+ return message;
222
+ }
223
+ return "";
224
+ }
225
+ function handleValidation() {
226
+ onValidation && onValidation(error);
227
+ }
228
+ }
229
+ function setAutocomplete(autocompleteSetting) {
230
+ if (autocompleteSetting === true) {
231
+ return undefined;
232
+ }
233
+ else if (autocompleteSetting === false) {
234
+ return "off";
235
+ }
236
+ return autocompleteSetting;
237
+ }
238
+ const getNamesAndIds = (name) => {
239
+ const identifierId = React.useId();
240
+ const [identifier] = React.useState(identifierId);
241
+ const descriptionId = React.useId();
242
+ const [descriptionIdentifier] = React.useState(`descriptionUUID--${descriptionId}`);
243
+ /**
244
+ * Generate a name if one is not supplied, this is the name
245
+ * that will be used for react-hook-form and not neccessarily
246
+ * attached to the DOM
247
+ */
248
+ const [controlledName] = React.useState(name ? name : `generatedName--${identifier}`);
249
+ return { descriptionIdentifier, controlledName, identifier };
250
+ };
251
+
252
+ exports.FormField = FormField;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var FormatDate = require('../FormatDate-70ea5b43.js');
5
+ var FormatDate = require('../FormatDate-6fc94218.js');
6
6
  require('react');
7
7
 
8
8
 
@@ -4,16 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var classnames = require('classnames');
7
- var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
8
7
 
9
8
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
9
 
11
10
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
11
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
13
12
 
14
- var css_248z = ".Cr7OFSgq9WA- {\n font-style: normal;\n}\n";
15
13
  var styles = {"email":"Cr7OFSgq9WA-"};
16
- styleInject_es.styleInject(css_248z);
17
14
 
18
15
  function FormatEmail({ email }) {
19
16
  const className = classnames__default["default"](styles.email);
@@ -2,33 +2,33 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var FormatFile = require('../FormatFile-3b650d02.js');
5
+ var FormatFile = require('../FormatFile-317b158a.js');
6
6
  require('react');
7
7
  require('classnames');
8
8
  require('filesize');
9
- require('../style-inject.es-9d2f5f4e.js');
10
- require('../Button-163a0641.js');
9
+ require('../Button-8bde6560.js');
11
10
  require('react-router-dom');
12
- require('../Icon-405a216c.js');
11
+ require('../Icon-361343e0.js');
13
12
  require('@jobber/design');
14
- require('../Typography-973b122e.js');
15
- require('../ConfirmationModal-0f85d96c.js');
13
+ require('../Typography-75f58b60.js');
14
+ require('../ConfirmationModal-f6c0afc7.js');
16
15
  require('@jobber/hooks/useOnKeyDown');
17
- require('../Modal-70daa0e2.js');
16
+ require('../Modal-357fd1df.js');
18
17
  require('react-dom');
19
18
  require('framer-motion');
20
19
  require('@jobber/hooks/useRefocusOnActivator');
21
20
  require('@jobber/hooks/useFocusTrap');
22
- require('../Heading-0f4ecb0c.js');
23
- require('../ButtonDismiss-2b98d075.js');
24
- require('../Content-2ca1ffe1.js');
25
- require('../Markdown-96070121.js');
26
- require('react-markdown');
27
- require('../Text-4a2bc89f.js');
28
- require('../Emphasis-b2d1b3aa.js');
29
- require('../Glimmer-cfa92a88.js');
30
- require('../tslib.es6-5b8768b7.js');
31
- require('../ProgressBar-b68edc8f.js');
21
+ require('../Heading-f066883a.js');
22
+ require('../ButtonDismiss-af17d76d.js');
23
+ require('../ClientOnly-4f3e136d.js');
24
+ require('../Content-80486307.js');
25
+ require('../Markdown-10fc9d3e.js');
26
+ require('../tslib.es6-a575af05.js');
27
+ require('markdown-to-jsx');
28
+ require('../Text-9f261dde.js');
29
+ require('../Emphasis-7a2893bb.js');
30
+ require('../Glimmer-f5c31401.js');
31
+ require('../ProgressBar-5c577dc0.js');
32
32
 
33
33
 
34
34