@servicetitan/marketing-ui 1.15.0 → 1.18.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.
Files changed (182) hide show
  1. package/CHANGELOG.md +353 -0
  2. package/dist/components/ads/ads-stat.js +13 -18
  3. package/dist/components/ads/ads-stat.js.map +1 -1
  4. package/dist/components/charts/funnel-chart/components/funnel-chart.js +15 -41
  5. package/dist/components/charts/funnel-chart/components/funnel-chart.js.map +1 -1
  6. package/dist/components/charts/funnel-chart/components/funnel-svg.js +9 -16
  7. package/dist/components/charts/funnel-chart/components/funnel-svg.js.map +1 -1
  8. package/dist/components/charts/funnel-chart/funnel-chart.stories.js +11 -14
  9. package/dist/components/charts/funnel-chart/funnel-chart.stories.js.map +1 -1
  10. package/dist/components/charts/funnel-chart/index.js +2 -16
  11. package/dist/components/charts/funnel-chart/index.js.map +1 -1
  12. package/dist/components/charts/funnel-chart/utils/const.js +2 -5
  13. package/dist/components/charts/funnel-chart/utils/const.js.map +1 -1
  14. package/dist/components/charts/funnel-chart/utils/interface.js +1 -2
  15. package/dist/components/charts/line-chart/components/body.js +26 -51
  16. package/dist/components/charts/line-chart/components/body.js.map +1 -1
  17. package/dist/components/charts/line-chart/components/container.js +12 -15
  18. package/dist/components/charts/line-chart/components/container.js.map +1 -1
  19. package/dist/components/charts/line-chart/components/hover-popover.js +20 -45
  20. package/dist/components/charts/line-chart/components/hover-popover.js.map +1 -1
  21. package/dist/components/charts/line-chart/components/sidebar.js +9 -35
  22. package/dist/components/charts/line-chart/components/sidebar.js.map +1 -1
  23. package/dist/components/charts/line-chart/components/stuff.js +13 -41
  24. package/dist/components/charts/line-chart/components/stuff.js.map +1 -1
  25. package/dist/components/charts/line-chart/components/svg-bars.js +14 -17
  26. package/dist/components/charts/line-chart/components/svg-bars.js.map +1 -1
  27. package/dist/components/charts/line-chart/components/svg-body.js +15 -41
  28. package/dist/components/charts/line-chart/components/svg-body.js.map +1 -1
  29. package/dist/components/charts/line-chart/components/svg-lines.js +11 -33
  30. package/dist/components/charts/line-chart/components/svg-lines.js.map +1 -1
  31. package/dist/components/charts/line-chart/index.js +2 -14
  32. package/dist/components/charts/line-chart/index.js.map +1 -1
  33. package/dist/components/charts/line-chart/line-chart.stories.js +19 -27
  34. package/dist/components/charts/line-chart/line-chart.stories.js.map +1 -1
  35. package/dist/components/charts/line-chart/stores/line-chart.store.js +20 -23
  36. package/dist/components/charts/line-chart/stores/line-chart.store.js.map +1 -1
  37. package/dist/components/charts/line-chart/stores/svg.store.js +10 -13
  38. package/dist/components/charts/line-chart/stores/svg.store.js.map +1 -1
  39. package/dist/components/charts/line-chart/utils/const.js +2 -6
  40. package/dist/components/charts/line-chart/utils/const.js.map +1 -1
  41. package/dist/components/charts/line-chart/utils/formatters.js +7 -11
  42. package/dist/components/charts/line-chart/utils/formatters.js.map +1 -1
  43. package/dist/components/charts/line-chart/utils/interfaces.js +1 -2
  44. package/dist/components/charts/line-chart/utils/internal-interfaces.js +1 -2
  45. package/dist/components/charts/line-chart/utils/key.js +1 -5
  46. package/dist/components/charts/line-chart/utils/key.js.map +1 -1
  47. package/dist/components/charts/line-chart/utils/labels.js +19 -26
  48. package/dist/components/charts/line-chart/utils/labels.js.map +1 -1
  49. package/dist/components/charts/pie-chart/components/pie-chart.js +12 -38
  50. package/dist/components/charts/pie-chart/components/pie-chart.js.map +1 -1
  51. package/dist/components/charts/pie-chart/components/pie.js +20 -27
  52. package/dist/components/charts/pie-chart/components/pie.js.map +1 -1
  53. package/dist/components/charts/pie-chart/index.js +1 -5
  54. package/dist/components/charts/pie-chart/index.js.map +1 -1
  55. package/dist/components/charts/pie-chart/pie-chart.stories.js +11 -18
  56. package/dist/components/charts/pie-chart/pie-chart.stories.js.map +1 -1
  57. package/dist/components/charts/pie-chart/utils/const.js +4 -8
  58. package/dist/components/charts/pie-chart/utils/const.js.map +1 -1
  59. package/dist/components/charts/pie-chart/utils/interface.js +1 -2
  60. package/dist/components/image-cropper/image-cropper.js +17 -23
  61. package/dist/components/image-cropper/image-cropper.js.map +1 -1
  62. package/dist/components/image-cropper/image-cropper.stories.js +10 -14
  63. package/dist/components/image-cropper/image-cropper.stories.js.map +1 -1
  64. package/dist/components/stat/stat-card.js +15 -42
  65. package/dist/components/stat/stat-card.js.map +1 -1
  66. package/dist/components/stat/stat-cards.stories.js +10 -13
  67. package/dist/components/stat/stat-cards.stories.js.map +1 -1
  68. package/dist/components/stat/stat-extended-card.js +9 -35
  69. package/dist/components/stat/stat-extended-card.js.map +1 -1
  70. package/dist/components/stat/stat-extended-card.stories.js +8 -11
  71. package/dist/components/stat/stat-extended-card.stories.js.map +1 -1
  72. package/dist/components/ui/action-button/action-button.d.ts +14 -0
  73. package/dist/components/ui/action-button/action-button.d.ts.map +1 -0
  74. package/dist/components/ui/action-button/action-button.js +32 -0
  75. package/dist/components/ui/action-button/action-button.js.map +1 -0
  76. package/dist/components/ui/action-button/action-button.module.less +51 -0
  77. package/dist/components/ui/action-button/action-button.stories.d.ts +10 -0
  78. package/dist/components/ui/action-button/action-button.stories.d.ts.map +1 -0
  79. package/dist/components/ui/action-button/action-button.stories.js +11 -0
  80. package/dist/components/ui/action-button/action-button.stories.js.map +1 -0
  81. package/dist/components/ui/action-button/index.d.ts +2 -0
  82. package/dist/components/ui/action-button/index.d.ts.map +1 -0
  83. package/dist/components/ui/action-button/index.js +2 -0
  84. package/dist/components/ui/action-button/index.js.map +1 -0
  85. package/dist/components/ui/{centered-spinner.d.ts → centered-spinner/centered-spinner.d.ts} +0 -0
  86. package/dist/components/ui/centered-spinner/centered-spinner.d.ts.map +1 -0
  87. package/dist/components/ui/centered-spinner/centered-spinner.js +7 -0
  88. package/dist/components/ui/centered-spinner/centered-spinner.js.map +1 -0
  89. package/dist/components/ui/{centered-spinner.stories.d.ts → centered-spinner/centered-spinner.stories.d.ts} +0 -0
  90. package/dist/components/ui/centered-spinner/centered-spinner.stories.d.ts.map +1 -0
  91. package/dist/components/ui/centered-spinner/centered-spinner.stories.js +12 -0
  92. package/dist/components/ui/centered-spinner/centered-spinner.stories.js.map +1 -0
  93. package/dist/components/ui/date-range-picker/date-range-picker.js +11 -36
  94. package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
  95. package/dist/components/ui/date-range-picker/date-range-picker.stories.js +9 -12
  96. package/dist/components/ui/date-range-picker/date-range-picker.stories.js.map +1 -1
  97. package/dist/components/ui/disabled-button.js +4 -8
  98. package/dist/components/ui/disabled-button.js.map +1 -1
  99. package/dist/components/ui/label-with-hint/label-with-hint.d.ts +10 -0
  100. package/dist/components/ui/label-with-hint/label-with-hint.d.ts.map +1 -0
  101. package/dist/components/ui/label-with-hint/label-with-hint.js +5 -0
  102. package/dist/components/ui/label-with-hint/label-with-hint.js.map +1 -0
  103. package/dist/components/ui/label-with-hint/label-with-hint.stories.d.ts +11 -0
  104. package/dist/components/ui/label-with-hint/label-with-hint.stories.d.ts.map +1 -0
  105. package/dist/components/ui/label-with-hint/label-with-hint.stories.js +12 -0
  106. package/dist/components/ui/label-with-hint/label-with-hint.stories.js.map +1 -0
  107. package/dist/components/ui/line-text/index.js +1 -13
  108. package/dist/components/ui/line-text/index.js.map +1 -1
  109. package/dist/components/ui/line-text/line-text-body.stories.js +7 -10
  110. package/dist/components/ui/line-text/line-text-body.stories.js.map +1 -1
  111. package/dist/components/ui/line-text/line-text-head.stories.js +7 -10
  112. package/dist/components/ui/line-text/line-text-head.stories.js.map +1 -1
  113. package/dist/components/ui/line-text/line-text.js +15 -42
  114. package/dist/components/ui/line-text/line-text.js.map +1 -1
  115. package/dist/components/ui/title-popover/index.d.ts +2 -0
  116. package/dist/components/ui/title-popover/index.d.ts.map +1 -0
  117. package/dist/components/ui/title-popover/index.js +2 -0
  118. package/dist/components/ui/title-popover/index.js.map +1 -0
  119. package/dist/components/ui/title-popover/title-popover.d.ts +17 -0
  120. package/dist/components/ui/title-popover/title-popover.d.ts.map +1 -0
  121. package/dist/components/ui/title-popover/title-popover.js +96 -0
  122. package/dist/components/ui/title-popover/title-popover.js.map +1 -0
  123. package/dist/components/ui/title-popover/title-popover.module.less +10 -0
  124. package/dist/components/ui/title-popover/title-popover.stories.d.ts +11 -0
  125. package/dist/components/ui/title-popover/title-popover.stories.d.ts.map +1 -0
  126. package/dist/components/ui/title-popover/title-popover.stories.js +17 -0
  127. package/dist/components/ui/title-popover/title-popover.stories.js.map +1 -0
  128. package/dist/index.d.ts +5 -1
  129. package/dist/index.d.ts.map +1 -1
  130. package/dist/index.js +16 -24
  131. package/dist/index.js.map +1 -1
  132. package/dist/utils/ads-texts.js +1 -4
  133. package/dist/utils/ads-texts.js.map +1 -1
  134. package/dist/utils/date/__mocks__/date-mock.js +1 -5
  135. package/dist/utils/date/__mocks__/date-mock.js.map +1 -1
  136. package/dist/utils/date/date-range-picker-options.js +7 -12
  137. package/dist/utils/date/date-range-picker-options.js.map +1 -1
  138. package/dist/utils/date/date-range-picker-state.js +6 -10
  139. package/dist/utils/date/date-range-picker-state.js.map +1 -1
  140. package/dist/utils/date/date-tenant.js +1 -5
  141. package/dist/utils/date/date-tenant.js.map +1 -1
  142. package/dist/utils/date/date.js +3 -9
  143. package/dist/utils/date/date.js.map +1 -1
  144. package/dist/utils/date/index.js +4 -16
  145. package/dist/utils/date/index.js.map +1 -1
  146. package/dist/utils/format-big-numbers.js +1 -5
  147. package/dist/utils/format-big-numbers.js.map +1 -1
  148. package/dist/utils/formatters.js +13 -41
  149. package/dist/utils/formatters.js.map +1 -1
  150. package/dist/utils/helpers.js +2 -7
  151. package/dist/utils/helpers.js.map +1 -1
  152. package/dist/utils/string-case.js +2 -7
  153. package/dist/utils/string-case.js.map +1 -1
  154. package/dist/utils/use-client-rect.js +7 -11
  155. package/dist/utils/use-client-rect.js.map +1 -1
  156. package/dist/utils/use-target-range-store.d.ts +7 -0
  157. package/dist/utils/use-target-range-store.d.ts.map +1 -0
  158. package/dist/utils/use-target-range-store.js +9 -0
  159. package/dist/utils/use-target-range-store.js.map +1 -0
  160. package/package.json +2 -2
  161. package/src/components/ui/action-button/action-button.module.less +51 -0
  162. package/src/components/ui/action-button/action-button.module.less.d.ts +9 -0
  163. package/src/components/ui/action-button/action-button.stories.tsx +19 -0
  164. package/src/components/ui/action-button/action-button.tsx +82 -0
  165. package/src/components/ui/action-button/index.tsx +1 -0
  166. package/src/components/ui/{centered-spinner.stories.tsx → centered-spinner/centered-spinner.stories.tsx} +0 -0
  167. package/src/components/ui/{centered-spinner.tsx → centered-spinner/centered-spinner.tsx} +0 -0
  168. package/src/components/ui/label-with-hint/label-with-hint.stories.tsx +29 -0
  169. package/src/components/ui/label-with-hint/label-with-hint.tsx +30 -0
  170. package/src/components/ui/title-popover/index.tsx +1 -0
  171. package/src/components/ui/title-popover/title-popover.module.less +10 -0
  172. package/src/components/ui/title-popover/title-popover.module.less.d.ts +3 -0
  173. package/src/components/ui/title-popover/title-popover.stories.tsx +28 -0
  174. package/src/components/ui/title-popover/title-popover.tsx +86 -0
  175. package/src/index.ts +5 -1
  176. package/src/utils/use-target-range-store.ts +17 -0
  177. package/dist/components/ui/centered-spinner.d.ts.map +0 -1
  178. package/dist/components/ui/centered-spinner.js +0 -14
  179. package/dist/components/ui/centered-spinner.js.map +0 -1
  180. package/dist/components/ui/centered-spinner.stories.d.ts.map +0 -1
  181. package/dist/components/ui/centered-spinner.stories.js +0 -15
  182. package/dist/components/ui/centered-spinner.stories.js.map +0 -1
@@ -0,0 +1,19 @@
1
+ import { ReactElement } from 'react';
2
+ import { ActionButton } from './action-button';
3
+
4
+ export default {
5
+ title: 'Marketing UI/ui/ActionButton',
6
+ component: ActionButton,
7
+ parameters: {},
8
+ };
9
+
10
+ const w = (style: { width?: string; height?: string }, cb: () => ReactElement) => () =>
11
+ <div style={style}>{cb()}</div>;
12
+
13
+ export const actionButtonHoverPrimary = w({}, () => (
14
+ <ActionButton hover="primary">Button</ActionButton>
15
+ ));
16
+
17
+ export const actionButtonHoverNegative = w({}, () => (
18
+ <ActionButton hover="negative">Button</ActionButton>
19
+ ));
@@ -0,0 +1,82 @@
1
+ import { ReactNode, FC, useRef } from 'react';
2
+ import classnames from 'classnames';
3
+ import {
4
+ Icon,
5
+ BodyText,
6
+ IconNameType,
7
+ Tooltip,
8
+ useFocusVisible,
9
+ } from '@servicetitan/design-system';
10
+ import * as Styles from './action-button.module.less';
11
+
12
+ export interface ActionButtonProps {
13
+ children: ReactNode;
14
+ iconName?: IconNameType;
15
+ hover?: 'primary' | 'negative' | 'none';
16
+ disabled?: boolean;
17
+ tooltip?: string;
18
+ qaPrefix?: string;
19
+ active?: boolean;
20
+ onClick?(): void;
21
+ }
22
+
23
+ export const ActionButton: FC<ActionButtonProps> = ({
24
+ onClick,
25
+ disabled,
26
+ children,
27
+ iconName,
28
+ hover,
29
+ qaPrefix,
30
+ active,
31
+ tooltip,
32
+ }) => {
33
+ const buttonRef = useRef<HTMLButtonElement>(null);
34
+ const { isFocusVisible, focusFunction, blurFunction } = useFocusVisible(buttonRef);
35
+
36
+ const handleClick = () => {
37
+ if (disabled) {
38
+ return;
39
+ }
40
+
41
+ if (onClick) {
42
+ onClick();
43
+ }
44
+ };
45
+
46
+ const getButton = () => {
47
+ const classes = classnames(Styles.actionButton, qaPrefix, {
48
+ [Styles.primary]: hover === 'primary' && !disabled,
49
+ [Styles.negative]: hover === 'negative' && !disabled,
50
+ [Styles.active]: active && !disabled,
51
+ [Styles.disabled]: disabled,
52
+ [Styles.focusVisible]: isFocusVisible,
53
+ });
54
+
55
+ return (
56
+ <button
57
+ type="button"
58
+ ref={buttonRef}
59
+ className={classes}
60
+ onClick={handleClick}
61
+ disabled={disabled}
62
+ onFocus={focusFunction}
63
+ onBlur={blurFunction}
64
+ >
65
+ {iconName && <Icon name={iconName} size="20px" className="m-r-1" />}
66
+ <BodyText className={classnames(Styles.text, `${qaPrefix}-text`)}>
67
+ {children}
68
+ </BodyText>
69
+ </button>
70
+ );
71
+ };
72
+
73
+ if (!tooltip) {
74
+ return getButton();
75
+ }
76
+
77
+ return (
78
+ <Tooltip text={tooltip} direction="l" el="div" className={`${qaPrefix}-tooltip`}>
79
+ {getButton()}
80
+ </Tooltip>
81
+ );
82
+ };
@@ -0,0 +1 @@
1
+ export * from './action-button';
@@ -0,0 +1,29 @@
1
+ import { Fragment } from 'react';
2
+ import { LabelWithHint } from './label-with-hint';
3
+
4
+ export default {
5
+ title: 'Marketing UI/ui/LabelWithHint',
6
+ component: LabelWithHint,
7
+ parameters: {},
8
+ };
9
+
10
+ export const Basic = () => <LabelWithHint label="Label" hint="Hint" />;
11
+
12
+ export const Custom = () => (
13
+ <LabelWithHint
14
+ label="Label"
15
+ hint="Hint"
16
+ textClassName="text-red-500"
17
+ className="bg-blue-500"
18
+ textSize="large"
19
+ />
20
+ );
21
+
22
+ export const Sizes = () => (
23
+ <Fragment>
24
+ <LabelWithHint label="Label" hint="Hint" textSize="large" />
25
+ <LabelWithHint label="Label" hint="Hint" textSize="medium" />
26
+ <LabelWithHint label="Label" hint="Hint" textSize="small" />
27
+ <LabelWithHint label="Label" hint="Hint" textSize="xsmall" />
28
+ </Fragment>
29
+ );
@@ -0,0 +1,30 @@
1
+ import { BodyText, Icon, Stack, Tooltip } from '@servicetitan/design-system';
2
+ import tokens from '@servicetitan/tokens';
3
+ import { FC } from 'react';
4
+
5
+ export interface LabelWithHintProps {
6
+ label: string;
7
+ hint?: string;
8
+ textClassName?: string;
9
+ className?: string;
10
+ textSize?: 'large' | 'medium' | 'small' | 'xsmall';
11
+ }
12
+
13
+ export const LabelWithHint: FC<LabelWithHintProps> = ({
14
+ label,
15
+ textClassName,
16
+ className,
17
+ hint,
18
+ textSize = 'small',
19
+ }) => (
20
+ <Stack spacing={1} alignItems="flex-start" className={className}>
21
+ <BodyText size={textSize} bold className={textClassName}>
22
+ {label}
23
+ </BodyText>
24
+ {!!hint && (
25
+ <Tooltip direction="tr" text={hint}>
26
+ <Icon name="info" size={18} color={tokens.colorNeutral80} />
27
+ </Tooltip>
28
+ )}
29
+ </Stack>
30
+ );
@@ -0,0 +1 @@
1
+ export * from './title-popover';
@@ -0,0 +1,10 @@
1
+ @import (reference) '@servicetitan/tokens/dist/tokens.less';
2
+
3
+ .popover {
4
+ padding: @spacing-0;
5
+
6
+ :global(.Popover__content) {
7
+ padding: @spacing-half @spacing-0;
8
+ overflow: visible;
9
+ }
10
+ }
@@ -0,0 +1,3 @@
1
+ export const __esModule: true;
2
+ export const popover: string;
3
+
@@ -0,0 +1,28 @@
1
+ import { ReactElement, useState } from 'react';
2
+ import { ActionButton } from '../action-button/action-button';
3
+ import { TitlePopover } from './title-popover';
4
+
5
+ export default {
6
+ title: 'Marketing UI/ui/TitlePopover',
7
+ component: TitlePopover,
8
+ parameters: {},
9
+ };
10
+
11
+ const w = (style: { width?: string; height?: string }, cb: () => ReactElement) => () =>
12
+ <div style={style}>{cb()}</div>;
13
+
14
+ export const titlePopover = w({}, () => <TitlePopover text="Title text">Content</TitlePopover>);
15
+ export const titlePopoverToggle = w({}, () => {
16
+ const [isActive, setIsActive] = useState(true);
17
+ const title = isActive ? 'Entities' : 'Archived Entities';
18
+ return (
19
+ <TitlePopover text={title}>
20
+ <ActionButton hover="primary" active={isActive} onClick={() => setIsActive(true)}>
21
+ Entities
22
+ </ActionButton>
23
+ <ActionButton hover="primary" active={!isActive} onClick={() => setIsActive(false)}>
24
+ Archived Entities
25
+ </ActionButton>
26
+ </TitlePopover>
27
+ );
28
+ });
@@ -0,0 +1,86 @@
1
+ import classNames from 'classnames';
2
+ import { observer } from 'mobx-react';
3
+ import { createRef, Component } from 'react';
4
+ import { observable, action, makeObservable } from 'mobx';
5
+ import { Popover, Stack, BodyText, Icon } from '@servicetitan/design-system';
6
+ import * as Styles from './title-popover.module.less';
7
+
8
+ interface TitlePopoverProps {
9
+ text?: string;
10
+ }
11
+
12
+ @observer
13
+ export class TitlePopover extends Component<TitlePopoverProps> {
14
+ @observable isOpen = false;
15
+
16
+ wrapElem = createRef<HTMLDivElement>();
17
+
18
+ constructor(props: TitlePopoverProps) {
19
+ super(props);
20
+ makeObservable(this);
21
+ }
22
+
23
+ @action
24
+ toggle = () => {
25
+ this.isOpen = !this.isOpen;
26
+ };
27
+
28
+ @action
29
+ close = () => {
30
+ this.isOpen = false;
31
+ };
32
+
33
+ @action
34
+ handleClick = (event: MouseEvent) => {
35
+ if (!this.wrapElem.current) {
36
+ return;
37
+ }
38
+
39
+ const isClickedInside = this.wrapElem.current.contains(event.target as Node);
40
+
41
+ if (!isClickedInside) {
42
+ this.close();
43
+ }
44
+ };
45
+
46
+ componentDidMount() {
47
+ window.addEventListener('click', this.handleClick);
48
+ }
49
+
50
+ componentWillUnmount() {
51
+ window.removeEventListener('click', this.handleClick);
52
+ }
53
+
54
+ render() {
55
+ const { text, children } = this.props;
56
+
57
+ return (
58
+ <div ref={this.wrapElem} className="qa-title-popover">
59
+ <Popover
60
+ className={classNames(Styles.popover, 'qa-title-popover')}
61
+ width="xs"
62
+ open={this.isOpen}
63
+ direction="br"
64
+ trigger={
65
+ <Stack
66
+ alignItems="center"
67
+ className="qa-title-popover-button cursor-pointer"
68
+ onClick={this.toggle}
69
+ >
70
+ <BodyText size="large" className="qa-title-popover-text">
71
+ {text}
72
+ </BodyText>
73
+ <Icon
74
+ name="expand_more"
75
+ size={20}
76
+ className="m-l-1 qa-title-popover-icon"
77
+ />
78
+ </Stack>
79
+ }
80
+ >
81
+ {children}
82
+ </Popover>
83
+ </div>
84
+ );
85
+ }
86
+ }
package/src/index.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  export * from './components/stat/stat-card';
2
2
  export * from './components/stat/stat-extended-card';
3
3
  export * from './components/ads/ads-stat';
4
- export * from './components/ui/centered-spinner';
4
+ export * from './components/ui/action-button';
5
+ export * from './components/ui/centered-spinner/centered-spinner';
6
+ export * from './components/ui/label-with-hint/label-with-hint';
5
7
  export * from './components/ui/line-text';
8
+ export * from './components/ui/title-popover';
6
9
  export * from './components/image-cropper/image-cropper';
7
10
 
8
11
  export * from './utils/ads-texts';
@@ -11,3 +14,4 @@ export * from './utils/string-case';
11
14
  export * from './utils/use-client-rect';
12
15
  export * from './utils/helpers';
13
16
  export * from './utils/format-big-numbers';
17
+ export * from './utils/use-target-range-store';
@@ -0,0 +1,17 @@
1
+ import { useLocalStore } from 'mobx-react';
2
+ import { action } from 'mobx';
3
+
4
+ export type OptionalRange = Range | undefined;
5
+
6
+ export interface TargetRangeStore {
7
+ targetRange: OptionalRange;
8
+ setTargetRange: (range: OptionalRange) => void;
9
+ }
10
+
11
+ export const useTargetRangeStore = () =>
12
+ useLocalStore<TargetRangeStore>(() => ({
13
+ targetRange: undefined,
14
+ setTargetRange: action(function (this: TargetRangeStore, range: OptionalRange) {
15
+ this.targetRange = range;
16
+ }),
17
+ }));
@@ -1 +0,0 @@
1
- {"version":3,"file":"centered-spinner.d.ts","sourceRoot":"","sources":["../../../src/components/ui/centered-spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,MAAM,WAAW,0BAA0B;IACvC,oBAAoB;IACpB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,0BAA0B,CAgB1D,CAAC"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CenteredSpinner = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const classnames_1 = __importDefault(require("classnames"));
9
- const design_system_1 = require("@servicetitan/design-system");
10
- const CenteredSpinner = ({ size, className, info }) => {
11
- return ((0, jsx_runtime_1.jsxs)(design_system_1.Stack, Object.assign({ justifyContent: "center", alignItems: "center", direction: "column", className: (0, classnames_1.default)(className, 'h-100 w-100') }, { children: [(0, jsx_runtime_1.jsx)(design_system_1.Spinner, { className: "of-hidden", size: size }, void 0), !!info && ((0, jsx_runtime_1.jsx)(design_system_1.BodyText, Object.assign({ size: "small", className: "m-t-1", subdued: true }, { children: info }), void 0))] }), void 0));
12
- };
13
- exports.CenteredSpinner = CenteredSpinner;
14
- //# sourceMappingURL=centered-spinner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"centered-spinner.js","sourceRoot":"","sources":["../../../src/components/ui/centered-spinner.tsx"],"names":[],"mappings":";;;;;;;AACA,4DAAoC;AACpC,+DAAuE;AAShE,MAAM,eAAe,GAAmC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE;IACzF,OAAO,CACH,wBAAC,qBAAK,kBACF,cAAc,EAAC,QAAQ,EACvB,UAAU,EAAC,QAAQ,EACnB,SAAS,EAAC,QAAQ,EAClB,SAAS,EAAE,IAAA,oBAAU,EAAC,SAAS,EAAE,aAAa,CAAC,iBAE/C,uBAAC,uBAAO,IAAC,SAAS,EAAC,WAAW,EAAC,IAAI,EAAE,IAAI,WAAI,EAC5C,CAAC,CAAC,IAAI,IAAI,CACP,uBAAC,wBAAQ,kBAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAC,OAAO,sBAC3C,IAAI,YACE,CACd,aACG,CACX,CAAC;AACN,CAAC,CAAC;AAhBW,QAAA,eAAe,mBAgB1B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"centered-spinner.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ui/centered-spinner.stories.tsx"],"names":[],"mappings":";;;;;;AAGA,wBAIE;AAKF,eAAO,MAAM,mBAAmB,mBAA+C,CAAC;AAChF,eAAO,MAAM,eAAe,mBAAoE,CAAC;AACjG,eAAO,MAAM,qBAAqB,mBAEhC,CAAC"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.centeredSpinnerTitled = exports.centeredSpinner = exports.centeredSpinnerTiny = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const centered_spinner_1 = require("./centered-spinner");
6
- exports.default = {
7
- title: 'Marketing UI/ui/CenteredSpinner',
8
- component: centered_spinner_1.CenteredSpinner,
9
- parameters: {},
10
- };
11
- const w = (style, cb) => () => (0, jsx_runtime_1.jsx)("div", Object.assign({ style: style }, { children: cb() }), void 0);
12
- exports.centeredSpinnerTiny = w({}, () => (0, jsx_runtime_1.jsx)(centered_spinner_1.CenteredSpinner, { size: "tiny" }, void 0));
13
- exports.centeredSpinner = w({ width: '400px', height: '400px' }, () => (0, jsx_runtime_1.jsx)(centered_spinner_1.CenteredSpinner, {}, void 0));
14
- exports.centeredSpinnerTitled = w({ width: '400px', height: '400px' }, () => ((0, jsx_runtime_1.jsx)(centered_spinner_1.CenteredSpinner, { info: "Wait for data fetch" }, void 0)));
15
- //# sourceMappingURL=centered-spinner.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"centered-spinner.stories.js","sourceRoot":"","sources":["../../../src/components/ui/centered-spinner.stories.tsx"],"names":[],"mappings":";;;;AACA,yDAAqD;AAErD,kBAAe;IACX,KAAK,EAAE,iCAAiC;IACxC,SAAS,EAAE,kCAAe;IAC1B,UAAU,EAAE,EAAE;CACjB,CAAC;AAEF,MAAM,CAAC,GAAG,CAAC,KAA0C,EAAE,EAAsB,EAAE,EAAE,CAAC,GAAG,EAAE,CACnF,8CAAK,KAAK,EAAE,KAAK,gBAAG,EAAE,EAAE,YAAO,CAAC;AAEvB,QAAA,mBAAmB,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,uBAAC,kCAAe,IAAC,IAAI,EAAC,MAAM,WAAG,CAAC,CAAC;AACnE,QAAA,eAAe,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,uBAAC,kCAAe,aAAG,CAAC,CAAC;AACpF,QAAA,qBAAqB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,CAC9E,uBAAC,kCAAe,IAAC,IAAI,EAAC,qBAAqB,WAAG,CACjD,CAAC,CAAC"}