@jobber/components 6.23.2 → 6.25.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.
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import type { PropsWithChildren } from "react";
1
+ import type { CSSProperties, PropsWithChildren } from "react";
3
2
  import { SideDrawerActions } from "./SideDrawerActions";
4
3
  import { SideDrawerTitle } from "./SideDrawerTitle";
5
4
  import { SideDrawerToolbar } from "./SideDrawerToolbar";
@@ -22,8 +21,29 @@ interface SideDrawerProps extends PropsWithChildren {
22
21
  * Change the scrolling direction of the drawer. Useful for chat-like interfaces.
23
22
  */
24
23
  readonly scrollDirection?: "normal" | "reverse";
24
+ /**
25
+ * Changes whether the SideDrawer is positioned to the side of the viewport or inline with the content.
26
+ * @default false
27
+ */
28
+ readonly inline?: boolean;
29
+ /**
30
+ * **Use at your own risk:** Custom class names for specific elements. This should only be used as a
31
+ * **last resort**. Using this may result in unexpected side effects.
32
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
33
+ */
34
+ readonly UNSAFE_className?: {
35
+ container?: string;
36
+ };
37
+ /**
38
+ * **Use at your own risk:** Custom style for specific elements. This should only be used as a
39
+ * **last resort**. Using this may result in unexpected side effects.
40
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
41
+ */
42
+ readonly UNSAFE_style?: {
43
+ container?: CSSProperties;
44
+ };
25
45
  }
26
- export declare function SideDrawer({ children, onRequestClose, open, variation, scrollDirection, }: SideDrawerProps): React.ReactPortal | null;
46
+ export declare function SideDrawer({ children, onRequestClose, open, variation, scrollDirection, inline, UNSAFE_className, UNSAFE_style, }: SideDrawerProps): JSX.Element | null;
27
47
  export declare namespace SideDrawer {
28
48
  var Title: typeof SideDrawerTitle;
29
49
  var Toolbar: typeof SideDrawerToolbar;
@@ -4,13 +4,13 @@ var SideDrawer = require('../SideDrawer-cjs.js');
4
4
  require('react');
5
5
  require('react-dom');
6
6
  require('framer-motion');
7
- require('@jobber/design');
8
7
  require('../useRefocusOnActivator-cjs.js');
9
8
  require('../useFocusTrap-cjs.js');
10
9
  require('classnames');
11
10
  require('../useInView-cjs.js');
12
11
  require('../useIsMounted-cjs.js');
13
12
  require('../useSafeLayoutEffect-cjs.js');
13
+ require('@jobber/design');
14
14
  require('../Heading-cjs.js');
15
15
  require('../Typography-cjs.js');
16
16
  require('../Button-cjs.js');
@@ -2,13 +2,13 @@ export { S as SideDrawer } from '../SideDrawer-es.js';
2
2
  import 'react';
3
3
  import 'react-dom';
4
4
  import 'framer-motion';
5
- import '@jobber/design';
6
5
  import '../useRefocusOnActivator-es.js';
7
6
  import '../useFocusTrap-es.js';
8
7
  import 'classnames';
9
8
  import '../useInView-es.js';
10
9
  import '../useIsMounted-es.js';
11
10
  import '../useSafeLayoutEffect-es.js';
11
+ import '@jobber/design';
12
12
  import '../Heading-es.js';
13
13
  import '../Typography-es.js';
14
14
  import '../Button-es.js';
@@ -3,12 +3,12 @@
3
3
  var React = require('react');
4
4
  var ReactDOM = require('react-dom');
5
5
  var framerMotion = require('framer-motion');
6
- var design = require('@jobber/design');
7
6
  var useRefocusOnActivator = require('./useRefocusOnActivator-cjs.js');
8
7
  var useFocusTrap = require('./useFocusTrap-cjs.js');
9
8
  var classnames = require('classnames');
10
9
  var useInView = require('./useInView-cjs.js');
11
10
  var useIsMounted = require('./useIsMounted-cjs.js');
11
+ var design = require('@jobber/design');
12
12
  var Heading = require('./Heading-cjs.js');
13
13
  var Button = require('./Button-cjs.js');
14
14
  var Flex = require('./Flex-cjs.js');
@@ -49,7 +49,7 @@ function SideDrawerToolbar({ children }) {
49
49
  return ReactDOM.createPortal(children, toolbarPortal);
50
50
  }
51
51
 
52
- var styles = {"drawer":"cCwRgRAz4qk-","container":"XipkpXgyzyg-","header":"LuqC0RF-R1U-","content":"vArEcEUxGxQ-","footer":"_4HzuRZKD9u8-","subtle":"v5Db-FCF2kU-","heading":"Eti1JL3rghE-","hasShadow":"PtbV1GtWwzY-","headerActions":"YCdqkhcLHfI-","hideWhenEmpty":"ZH2Mp84HhX8-","overlay":"Ro-pE7hx0wY-","reverseScroll":"gSN5nWDwGm4-","headerShadowListener":"tMeBAjf4vEA-","footerShadowListener":"-lPSZVGIIAs-","backButton":"XOqA4Hw6S6g-","backButtonVisible":"b4VHPS-RG34-","spinning":"McL3-VWXVbs-"};
52
+ var styles = {"drawer":"cCwRgRAz4qk-","inline":"ONUfsWMLKdo-","container":"XipkpXgyzyg-","header":"LuqC0RF-R1U-","content":"vArEcEUxGxQ-","footer":"_4HzuRZKD9u8-","subtle":"v5Db-FCF2kU-","heading":"Eti1JL3rghE-","hasShadow":"PtbV1GtWwzY-","headerActions":"YCdqkhcLHfI-","hideWhenEmpty":"ZH2Mp84HhX8-","overlay":"Ro-pE7hx0wY-","reverseScroll":"gSN5nWDwGm4-","headerShadowListener":"tMeBAjf4vEA-","footerShadowListener":"-lPSZVGIIAs-","backButton":"XOqA4Hw6S6g-","backButtonVisible":"b4VHPS-RG34-","spinning":"McL3-VWXVbs-"};
53
53
 
54
54
  function SideDrawerBackButton({ onClick, }) {
55
55
  const { backPortal, registerComponent, unRegisterComponent } = useSideDrawerContext();
@@ -72,11 +72,16 @@ function SideDrawerFooter({ children }) {
72
72
  }
73
73
 
74
74
  const variants = {
75
- hidden: { x: "100%" },
75
+ initial: { x: "100%" },
76
76
  visible: { x: 0, transitionEnd: { x: 0 } },
77
+ hidden: { x: "100%" },
77
78
  };
78
- function SideDrawer({ children, onRequestClose, open, variation = "base", scrollDirection, }) {
79
- var _a;
79
+ const inlineVariants = {
80
+ initial: { x: "25%", opacity: 0 },
81
+ visible: { x: 0, opacity: 1, transitionEnd: { x: 0 } },
82
+ hidden: { x: "25%", opacity: 0 },
83
+ };
84
+ const useSideDrawerState = (open) => {
80
85
  const [ref, setRef] = React.useState(null);
81
86
  const [components, setComponents] = React.useState({
82
87
  backButton: false,
@@ -86,26 +91,44 @@ function SideDrawer({ children, onRequestClose, open, variation = "base", scroll
86
91
  const sideDrawerRef = useFocusTrap.useFocusTrap_2(open);
87
92
  const [headerShadowRef, noHeaderShadow] = useInView.useInView_2();
88
93
  const [footerShadowRef, noFooterShadow] = useInView.useInView_2();
94
+ return {
95
+ ref,
96
+ setRef,
97
+ components,
98
+ setComponents,
99
+ slots: { toolbar, title, actions, backButton, footer },
100
+ sideDrawerRef,
101
+ headerShadowRef,
102
+ noHeaderShadow,
103
+ footerShadowRef,
104
+ noFooterShadow,
105
+ };
106
+ };
107
+ function SideDrawer({ children, onRequestClose, open, variation = "base", scrollDirection, inline = false, UNSAFE_className, UNSAFE_style, }) {
108
+ var _a;
109
+ const { ref, setRef, components, setComponents, slots, sideDrawerRef, headerShadowRef, noHeaderShadow, footerShadowRef, noFooterShadow, } = useSideDrawerState(open);
110
+ useRefocusOnActivator.useRefocusOnActivator_2(open);
89
111
  const container = ((_a = globalThis.document) === null || _a === void 0 ? void 0 : _a.body) || null;
90
112
  const isMounted = useIsMounted.useIsMounted_2();
91
113
  if (!isMounted.current && !container)
92
114
  return null;
93
- return ReactDOM.createPortal(React.createElement(SideDrawerContext.Provider, { value: {
94
- actionPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(actions.selector),
95
- titlePortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(title.selector),
96
- toolbarPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(toolbar.selector),
97
- backPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(backButton.selector),
98
- footerPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(footer.selector),
115
+ const SideDrawerRender = (React.createElement(SideDrawerContext.Provider, { value: {
116
+ actionPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(slots.actions.selector),
117
+ titlePortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(slots.title.selector),
118
+ toolbarPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(slots.toolbar.selector),
119
+ backPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(slots.backButton.selector),
120
+ footerPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(slots.footer.selector),
99
121
  components,
100
122
  registerComponent: key => setComponents(prev => (Object.assign(Object.assign({}, prev), { [key]: true }))),
101
123
  unRegisterComponent: key => setComponents(prev => (Object.assign(Object.assign({}, prev), { [key]: false }))),
102
124
  } },
103
- open && (React.createElement("button", { className: styles.overlay, "aria-label": "Close", onClick: onRequestClose, type: "button" })),
125
+ open && !inline && (React.createElement("button", { className: styles.overlay, "aria-label": "Close", onClick: onRequestClose, type: "button" })),
104
126
  React.createElement(framerMotion.AnimatePresence, { initial: false }, open && (React.createElement(framerMotion.motion.div, { className: classnames(styles.drawer, {
105
127
  [styles.reverseScroll]: scrollDirection === "reverse",
106
- }), ref: setRef, "data-elevation": "elevated", variants: variants, initial: "hidden", animate: "visible", exit: "hidden", transition: {
128
+ [styles.inline]: inline,
129
+ }, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container), ref: setRef, "data-elevation": "elevated", variants: inline ? inlineVariants : variants, initial: "initial", animate: "visible", exit: "hidden", transition: {
107
130
  duration: design.tokens["timing-base"] / 1000,
108
- } },
131
+ }, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container },
109
132
  React.createElement("div", { ref: sideDrawerRef, role: "dialog", className: classnames(styles.container, styles.hasShadow, {
110
133
  [styles.subtle]: variation === "subtle",
111
134
  }), tabIndex: 0, onKeyUp: handleKeyUp },
@@ -116,19 +139,23 @@ function SideDrawer({ children, onRequestClose, open, variation = "base", scroll
116
139
  React.createElement(Flex.Flex, { template: ["shrink", "grow"], align: "start", gap: "none" },
117
140
  React.createElement("div", Object.assign({ className: classnames(styles.backButton, {
118
141
  [styles.backButtonVisible]: components.backButton,
119
- }) }, backButton.attr)),
120
- React.createElement("div", Object.assign({ className: classnames(styles.heading) }, title.attr))),
142
+ }) }, slots.backButton.attr)),
143
+ React.createElement("div", Object.assign({ className: classnames(styles.heading) }, slots.title.attr))),
121
144
  React.createElement("div", { className: styles.headerActions },
122
- React.createElement("div", Object.assign({ className: styles.hideWhenEmpty }, actions.attr)),
145
+ React.createElement("div", Object.assign({ className: styles.hideWhenEmpty }, slots.actions.attr)),
123
146
  React.createElement(Button.Button, { ariaLabel: "Close", icon: "cross", onClick: onRequestClose, type: "tertiary", variation: "subtle" }))),
124
- React.createElement("div", Object.assign({ className: styles.hideWhenEmpty }, toolbar.attr))),
147
+ React.createElement("div", Object.assign({ className: styles.hideWhenEmpty }, slots.toolbar.attr))),
125
148
  React.createElement("div", { className: styles.content },
126
149
  React.createElement("div", { className: styles.headerShadowListener, ref: headerShadowRef }),
127
150
  children,
128
151
  React.createElement("div", { className: styles.footerShadowListener, ref: footerShadowRef })),
129
152
  React.createElement("div", Object.assign({ className: classnames(styles.footer, styles.hideWhenEmpty, {
130
153
  [styles.hasShadow]: footerShadowRef.current && !noFooterShadow,
131
- }) }, footer.attr))))))), container);
154
+ }) }, slots.footer.attr))))))));
155
+ if (inline) {
156
+ return SideDrawerRender;
157
+ }
158
+ return ReactDOM.createPortal(SideDrawerRender, container);
132
159
  function handleKeyUp(event) {
133
160
  if (event.key === "Escape") {
134
161
  onRequestClose();
@@ -1,12 +1,12 @@
1
1
  import React, { createContext, useContext, useEffect, useState, useId } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import { AnimatePresence, motion } from 'framer-motion';
4
- import { tokens } from '@jobber/design';
5
4
  import { u as useRefocusOnActivator_2 } from './useRefocusOnActivator-es.js';
6
5
  import { u as useFocusTrap_2 } from './useFocusTrap-es.js';
7
6
  import classnames from 'classnames';
8
7
  import { u as useInView_2 } from './useInView-es.js';
9
8
  import { u as useIsMounted_2 } from './useIsMounted-es.js';
9
+ import { tokens } from '@jobber/design';
10
10
  import { H as Heading } from './Heading-es.js';
11
11
  import { B as Button } from './Button-es.js';
12
12
  import { F as Flex } from './Flex-es.js';
@@ -47,7 +47,7 @@ function SideDrawerToolbar({ children }) {
47
47
  return createPortal(children, toolbarPortal);
48
48
  }
49
49
 
50
- var styles = {"drawer":"cCwRgRAz4qk-","container":"XipkpXgyzyg-","header":"LuqC0RF-R1U-","content":"vArEcEUxGxQ-","footer":"_4HzuRZKD9u8-","subtle":"v5Db-FCF2kU-","heading":"Eti1JL3rghE-","hasShadow":"PtbV1GtWwzY-","headerActions":"YCdqkhcLHfI-","hideWhenEmpty":"ZH2Mp84HhX8-","overlay":"Ro-pE7hx0wY-","reverseScroll":"gSN5nWDwGm4-","headerShadowListener":"tMeBAjf4vEA-","footerShadowListener":"-lPSZVGIIAs-","backButton":"XOqA4Hw6S6g-","backButtonVisible":"b4VHPS-RG34-","spinning":"McL3-VWXVbs-"};
50
+ var styles = {"drawer":"cCwRgRAz4qk-","inline":"ONUfsWMLKdo-","container":"XipkpXgyzyg-","header":"LuqC0RF-R1U-","content":"vArEcEUxGxQ-","footer":"_4HzuRZKD9u8-","subtle":"v5Db-FCF2kU-","heading":"Eti1JL3rghE-","hasShadow":"PtbV1GtWwzY-","headerActions":"YCdqkhcLHfI-","hideWhenEmpty":"ZH2Mp84HhX8-","overlay":"Ro-pE7hx0wY-","reverseScroll":"gSN5nWDwGm4-","headerShadowListener":"tMeBAjf4vEA-","footerShadowListener":"-lPSZVGIIAs-","backButton":"XOqA4Hw6S6g-","backButtonVisible":"b4VHPS-RG34-","spinning":"McL3-VWXVbs-"};
51
51
 
52
52
  function SideDrawerBackButton({ onClick, }) {
53
53
  const { backPortal, registerComponent, unRegisterComponent } = useSideDrawerContext();
@@ -70,11 +70,16 @@ function SideDrawerFooter({ children }) {
70
70
  }
71
71
 
72
72
  const variants = {
73
- hidden: { x: "100%" },
73
+ initial: { x: "100%" },
74
74
  visible: { x: 0, transitionEnd: { x: 0 } },
75
+ hidden: { x: "100%" },
75
76
  };
76
- function SideDrawer({ children, onRequestClose, open, variation = "base", scrollDirection, }) {
77
- var _a;
77
+ const inlineVariants = {
78
+ initial: { x: "25%", opacity: 0 },
79
+ visible: { x: 0, opacity: 1, transitionEnd: { x: 0 } },
80
+ hidden: { x: "25%", opacity: 0 },
81
+ };
82
+ const useSideDrawerState = (open) => {
78
83
  const [ref, setRef] = useState(null);
79
84
  const [components, setComponents] = useState({
80
85
  backButton: false,
@@ -84,26 +89,44 @@ function SideDrawer({ children, onRequestClose, open, variation = "base", scroll
84
89
  const sideDrawerRef = useFocusTrap_2(open);
85
90
  const [headerShadowRef, noHeaderShadow] = useInView_2();
86
91
  const [footerShadowRef, noFooterShadow] = useInView_2();
92
+ return {
93
+ ref,
94
+ setRef,
95
+ components,
96
+ setComponents,
97
+ slots: { toolbar, title, actions, backButton, footer },
98
+ sideDrawerRef,
99
+ headerShadowRef,
100
+ noHeaderShadow,
101
+ footerShadowRef,
102
+ noFooterShadow,
103
+ };
104
+ };
105
+ function SideDrawer({ children, onRequestClose, open, variation = "base", scrollDirection, inline = false, UNSAFE_className, UNSAFE_style, }) {
106
+ var _a;
107
+ const { ref, setRef, components, setComponents, slots, sideDrawerRef, headerShadowRef, noHeaderShadow, footerShadowRef, noFooterShadow, } = useSideDrawerState(open);
108
+ useRefocusOnActivator_2(open);
87
109
  const container = ((_a = globalThis.document) === null || _a === void 0 ? void 0 : _a.body) || null;
88
110
  const isMounted = useIsMounted_2();
89
111
  if (!isMounted.current && !container)
90
112
  return null;
91
- return createPortal(React.createElement(SideDrawerContext.Provider, { value: {
92
- actionPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(actions.selector),
93
- titlePortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(title.selector),
94
- toolbarPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(toolbar.selector),
95
- backPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(backButton.selector),
96
- footerPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(footer.selector),
113
+ const SideDrawerRender = (React.createElement(SideDrawerContext.Provider, { value: {
114
+ actionPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(slots.actions.selector),
115
+ titlePortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(slots.title.selector),
116
+ toolbarPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(slots.toolbar.selector),
117
+ backPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(slots.backButton.selector),
118
+ footerPortal: ref === null || ref === void 0 ? void 0 : ref.querySelector(slots.footer.selector),
97
119
  components,
98
120
  registerComponent: key => setComponents(prev => (Object.assign(Object.assign({}, prev), { [key]: true }))),
99
121
  unRegisterComponent: key => setComponents(prev => (Object.assign(Object.assign({}, prev), { [key]: false }))),
100
122
  } },
101
- open && (React.createElement("button", { className: styles.overlay, "aria-label": "Close", onClick: onRequestClose, type: "button" })),
123
+ open && !inline && (React.createElement("button", { className: styles.overlay, "aria-label": "Close", onClick: onRequestClose, type: "button" })),
102
124
  React.createElement(AnimatePresence, { initial: false }, open && (React.createElement(motion.div, { className: classnames(styles.drawer, {
103
125
  [styles.reverseScroll]: scrollDirection === "reverse",
104
- }), ref: setRef, "data-elevation": "elevated", variants: variants, initial: "hidden", animate: "visible", exit: "hidden", transition: {
126
+ [styles.inline]: inline,
127
+ }, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container), ref: setRef, "data-elevation": "elevated", variants: inline ? inlineVariants : variants, initial: "initial", animate: "visible", exit: "hidden", transition: {
105
128
  duration: tokens["timing-base"] / 1000,
106
- } },
129
+ }, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container },
107
130
  React.createElement("div", { ref: sideDrawerRef, role: "dialog", className: classnames(styles.container, styles.hasShadow, {
108
131
  [styles.subtle]: variation === "subtle",
109
132
  }), tabIndex: 0, onKeyUp: handleKeyUp },
@@ -114,19 +137,23 @@ function SideDrawer({ children, onRequestClose, open, variation = "base", scroll
114
137
  React.createElement(Flex, { template: ["shrink", "grow"], align: "start", gap: "none" },
115
138
  React.createElement("div", Object.assign({ className: classnames(styles.backButton, {
116
139
  [styles.backButtonVisible]: components.backButton,
117
- }) }, backButton.attr)),
118
- React.createElement("div", Object.assign({ className: classnames(styles.heading) }, title.attr))),
140
+ }) }, slots.backButton.attr)),
141
+ React.createElement("div", Object.assign({ className: classnames(styles.heading) }, slots.title.attr))),
119
142
  React.createElement("div", { className: styles.headerActions },
120
- React.createElement("div", Object.assign({ className: styles.hideWhenEmpty }, actions.attr)),
143
+ React.createElement("div", Object.assign({ className: styles.hideWhenEmpty }, slots.actions.attr)),
121
144
  React.createElement(Button, { ariaLabel: "Close", icon: "cross", onClick: onRequestClose, type: "tertiary", variation: "subtle" }))),
122
- React.createElement("div", Object.assign({ className: styles.hideWhenEmpty }, toolbar.attr))),
145
+ React.createElement("div", Object.assign({ className: styles.hideWhenEmpty }, slots.toolbar.attr))),
123
146
  React.createElement("div", { className: styles.content },
124
147
  React.createElement("div", { className: styles.headerShadowListener, ref: headerShadowRef }),
125
148
  children,
126
149
  React.createElement("div", { className: styles.footerShadowListener, ref: footerShadowRef })),
127
150
  React.createElement("div", Object.assign({ className: classnames(styles.footer, styles.hideWhenEmpty, {
128
151
  [styles.hasShadow]: footerShadowRef.current && !noFooterShadow,
129
- }) }, footer.attr))))))), container);
152
+ }) }, slots.footer.attr))))))));
153
+ if (inline) {
154
+ return SideDrawerRender;
155
+ }
156
+ return createPortal(SideDrawerRender, container);
130
157
  function handleKeyUp(event) {
131
158
  if (event.key === "Escape") {
132
159
  onRequestClose();
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import { CSSProperties, ReactNode } from "react";
2
2
  import fontSizes from "./css/FontSizes.module.css";
3
3
  import fontWeights from "./css/FontWeights.module.css";
4
4
  import textCases from "./css/TextCases.module.css";
@@ -42,6 +42,22 @@ export interface TypographyProps {
42
42
  * @example "double color-invoice" for a double underline in the specified color
43
43
  */
44
44
  readonly underline?: UnderlineStyle | UnderlineStyleWithColor | undefined;
45
+ /**
46
+ * **Use at your own risk:** Custom classNames for specific elements. This should only be used as a
47
+ * **last resort**. Using this may result in unexpected side effects.
48
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
49
+ */
50
+ readonly UNSAFE_className?: {
51
+ textStyle?: string;
52
+ };
53
+ /**
54
+ * **Use at your own risk:** Custom style for specific elements. This should only be used as a
55
+ * **last resort**. Using this may result in unexpected side effects.
56
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
57
+ */
58
+ readonly UNSAFE_style?: {
59
+ textStyle?: CSSProperties;
60
+ };
45
61
  }
46
62
  export type TypographyOptions = Omit<TypographyProps, "children">;
47
- export declare function Typography({ id, children, element: Tag, size, align, fontWeight, textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, }: TypographyProps): JSX.Element;
63
+ export declare function Typography({ id, children, element: Tag, size, align, fontWeight, textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, UNSAFE_className, UNSAFE_style, }: TypographyProps): JSX.Element;
@@ -23,32 +23,33 @@ var fontFamilies = {"base":"V9SSKxs15xE-","display":"dvw7zxC9s9g-","spinning":"N
23
23
 
24
24
  var underlineStyles = {"basicUnderline":"qp8E5e4q-so-","spinning":"F-Ybr7sJi6Q-"};
25
25
 
26
- function Typography({ id, children, element: Tag = "p", size, align, fontWeight = "regular", textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, }) {
26
+ function Typography({ id, children, element: Tag = "p", size, align, fontWeight = "regular", textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, UNSAFE_className, UNSAFE_style, }) {
27
27
  const shouldTruncateText = numberOfLines && numberOfLines > 0;
28
- const className = classnames(styles.base, fontWeights[fontWeight], size && fontSizes[size], textCase && textCases[textCase], textColor && textColors[textColor], emphasisType && emphasis[emphasisType], fontFamily && fontFamilies[fontFamily], shouldTruncateText && truncate.textTruncate, underline && underlineStyles.basicUnderline, Object.assign({}, (align && { [alignment[align]]: align !== `start` })));
29
- let stylesOverrides = {};
30
- if (shouldTruncateText) {
31
- stylesOverrides = {
28
+ const className = classnames(styles.base, fontWeights[fontWeight], size && fontSizes[size], textCase && textCases[textCase], textColor && textColors[textColor], emphasisType && emphasis[emphasisType], fontFamily && fontFamilies[fontFamily], shouldTruncateText && truncate.textTruncate, underline && underlineStyles.basicUnderline, Object.assign({}, (align && { [alignment[align]]: align !== `start` })), UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.textStyle);
29
+ const truncateStyles = shouldTruncateText
30
+ ? {
32
31
  WebkitLineClamp: numberOfLines,
33
32
  WebkitBoxOrient: "vertical",
34
- };
35
- }
36
- if (underline) {
37
- const [underlineStyle, underlineColor] = underline.split(" ");
38
- stylesOverrides.textDecorationStyle = underlineStyle;
39
- stylesOverrides.textDecorationColor = computeUnderlineColor(underlineColor, textColor);
40
- }
41
- return (React.createElement(Tag, { id: id, className: className, style: stylesOverrides }, children));
33
+ }
34
+ : {};
35
+ const underlineInlineStyles = computeUnderlineStyles(underline, textColor);
36
+ return (React.createElement(Tag, { id: id, className: className, style: Object.assign(Object.assign(Object.assign({}, truncateStyles), underlineInlineStyles), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.textStyle) }, children));
42
37
  }
43
- function computeUnderlineColor(textDecorationColor, textColor) {
44
- // Use the specified underline color if one is provided. If no underline color
45
- // is specified, fall back to the text color for the underline.
46
- if (textDecorationColor) {
47
- return `var(--${textDecorationColor})`;
38
+ function computeUnderlineStyles(underline, textColor) {
39
+ if (!underline) {
40
+ return {};
41
+ }
42
+ const [underlineStyle, underlineColor] = underline.split(" ");
43
+ const underlineInlineStyles = {
44
+ textDecorationStyle: underlineStyle,
45
+ };
46
+ if (underlineColor) {
47
+ underlineInlineStyles.textDecorationColor = `var(--${underlineColor})`;
48
48
  }
49
- if (textColor) {
50
- return textColors[textColor];
49
+ else if (textColor) {
50
+ underlineInlineStyles.textDecorationColor = textColors[textColor];
51
51
  }
52
+ return underlineInlineStyles;
52
53
  }
53
54
 
54
55
  exports.Typography = Typography;
@@ -21,32 +21,33 @@ var fontFamilies = {"base":"V9SSKxs15xE-","display":"dvw7zxC9s9g-","spinning":"N
21
21
 
22
22
  var underlineStyles = {"basicUnderline":"qp8E5e4q-so-","spinning":"F-Ybr7sJi6Q-"};
23
23
 
24
- function Typography({ id, children, element: Tag = "p", size, align, fontWeight = "regular", textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, }) {
24
+ function Typography({ id, children, element: Tag = "p", size, align, fontWeight = "regular", textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, UNSAFE_className, UNSAFE_style, }) {
25
25
  const shouldTruncateText = numberOfLines && numberOfLines > 0;
26
- const className = classnames(styles.base, fontWeights[fontWeight], size && fontSizes[size], textCase && textCases[textCase], textColor && textColors[textColor], emphasisType && emphasis[emphasisType], fontFamily && fontFamilies[fontFamily], shouldTruncateText && truncate.textTruncate, underline && underlineStyles.basicUnderline, Object.assign({}, (align && { [alignment[align]]: align !== `start` })));
27
- let stylesOverrides = {};
28
- if (shouldTruncateText) {
29
- stylesOverrides = {
26
+ const className = classnames(styles.base, fontWeights[fontWeight], size && fontSizes[size], textCase && textCases[textCase], textColor && textColors[textColor], emphasisType && emphasis[emphasisType], fontFamily && fontFamilies[fontFamily], shouldTruncateText && truncate.textTruncate, underline && underlineStyles.basicUnderline, Object.assign({}, (align && { [alignment[align]]: align !== `start` })), UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.textStyle);
27
+ const truncateStyles = shouldTruncateText
28
+ ? {
30
29
  WebkitLineClamp: numberOfLines,
31
30
  WebkitBoxOrient: "vertical",
32
- };
33
- }
34
- if (underline) {
35
- const [underlineStyle, underlineColor] = underline.split(" ");
36
- stylesOverrides.textDecorationStyle = underlineStyle;
37
- stylesOverrides.textDecorationColor = computeUnderlineColor(underlineColor, textColor);
38
- }
39
- return (React.createElement(Tag, { id: id, className: className, style: stylesOverrides }, children));
31
+ }
32
+ : {};
33
+ const underlineInlineStyles = computeUnderlineStyles(underline, textColor);
34
+ return (React.createElement(Tag, { id: id, className: className, style: Object.assign(Object.assign(Object.assign({}, truncateStyles), underlineInlineStyles), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.textStyle) }, children));
40
35
  }
41
- function computeUnderlineColor(textDecorationColor, textColor) {
42
- // Use the specified underline color if one is provided. If no underline color
43
- // is specified, fall back to the text color for the underline.
44
- if (textDecorationColor) {
45
- return `var(--${textDecorationColor})`;
36
+ function computeUnderlineStyles(underline, textColor) {
37
+ if (!underline) {
38
+ return {};
39
+ }
40
+ const [underlineStyle, underlineColor] = underline.split(" ");
41
+ const underlineInlineStyles = {
42
+ textDecorationStyle: underlineStyle,
43
+ };
44
+ if (underlineColor) {
45
+ underlineInlineStyles.textDecorationColor = `var(--${underlineColor})`;
46
46
  }
47
- if (textColor) {
48
- return textColors[textColor];
47
+ else if (textColor) {
48
+ underlineInlineStyles.textDecorationColor = textColors[textColor];
49
49
  }
50
+ return underlineInlineStyles;
50
51
  }
51
52
 
52
53
  export { Typography as T };
package/dist/styles.css CHANGED
@@ -8777,6 +8777,12 @@ html.atlantisLightBoxActive {
8777
8777
  max-width: 420px;
8778
8778
  }
8779
8779
 
8780
+ .cCwRgRAz4qk-.ONUfsWMLKdo- {
8781
+ position: static;
8782
+ width: 100%;
8783
+ height: 100%;
8784
+ }
8785
+
8780
8786
  .XipkpXgyzyg-,
8781
8787
  .cCwRgRAz4qk-,
8782
8788
  .LuqC0RF-R1U-,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "6.23.2",
3
+ "version": "6.25.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -489,5 +489,5 @@
489
489
  "> 1%",
490
490
  "IE 10"
491
491
  ],
492
- "gitHead": "3f16b3b782378b489c4813780ce1858c27ebb486"
492
+ "gitHead": "b5aa4ca87e9b0899c7aeacb09056bd8c6f10d13a"
493
493
  }