@bikdotai/bik-component-library 0.0.865-beta.7 → 0.0.865-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/button/Button.js +1 -1
- package/dist/cjs/components/button/Button.js.map +1 -1
- package/dist/cjs/components/button/Button.styled.js +2 -2
- package/dist/cjs/components/button/Button.styled.js.map +1 -1
- package/dist/cjs/components/chip-selector/ChipSelector.js +2 -0
- package/dist/cjs/components/chip-selector/ChipSelector.js.map +1 -0
- package/dist/cjs/components/chip-selector/ChipSelector.styled.js +36 -0
- package/dist/cjs/components/chip-selector/ChipSelector.styled.js.map +1 -0
- package/dist/cjs/components/chip-selector/ChipSelectorGroup.js +2 -0
- package/dist/cjs/components/chip-selector/ChipSelectorGroup.js.map +1 -0
- package/dist/cjs/components/combo-box/ComboBox.js +2 -0
- package/dist/cjs/components/combo-box/ComboBox.js.map +1 -0
- package/dist/cjs/components/combo-box/ComboBox.styled.js +33 -0
- package/dist/cjs/components/combo-box/ComboBox.styled.js.map +1 -0
- package/dist/cjs/components/datePicker/DatePickerWrapper.js +1 -1
- package/dist/cjs/components/datePicker/DatePickerWrapper.js.map +1 -1
- package/dist/cjs/components/dropdown-button/DropdownButton.js +1 -1
- package/dist/cjs/components/dropdown-button/DropdownButton.js.map +1 -1
- package/dist/cjs/components/schedule-builder/RefreshSegmentToggle.js +2 -0
- package/dist/cjs/components/schedule-builder/RefreshSegmentToggle.js.map +1 -0
- package/dist/cjs/components/schedule-builder/ScheduleBuilder.js +2 -0
- package/dist/cjs/components/schedule-builder/ScheduleBuilder.js.map +1 -0
- package/dist/cjs/components/schedule-builder/ScheduleBuilder.styled.js +138 -0
- package/dist/cjs/components/schedule-builder/ScheduleBuilder.styled.js.map +1 -0
- package/dist/cjs/components/schedule-builder/ScheduleEndPicker.js +2 -0
- package/dist/cjs/components/schedule-builder/ScheduleEndPicker.js.map +1 -0
- package/dist/cjs/components/schedule-builder/ScheduleFrequencyPicker.js +2 -0
- package/dist/cjs/components/schedule-builder/ScheduleFrequencyPicker.js.map +1 -0
- package/dist/cjs/components/schedule-builder/ScheduleHelper.js +2 -0
- package/dist/cjs/components/schedule-builder/ScheduleHelper.js.map +1 -0
- package/dist/cjs/components/schedule-builder/SendModeSelector.js +2 -0
- package/dist/cjs/components/schedule-builder/SendModeSelector.js.map +1 -0
- package/dist/cjs/components/schedule-builder/StartDateTimePicker.js +2 -0
- package/dist/cjs/components/schedule-builder/StartDateTimePicker.js.map +1 -0
- package/dist/cjs/components/schedule-builder/UpcomingRunsPreview.js +2 -0
- package/dist/cjs/components/schedule-builder/UpcomingRunsPreview.js.map +1 -0
- package/dist/cjs/components/schedule-builder/model.js +2 -0
- package/dist/cjs/components/schedule-builder/model.js.map +1 -0
- package/dist/cjs/components/tag/Tag.js +1 -1
- package/dist/cjs/components/tag/Tag.js.map +1 -1
- package/dist/cjs/components/tag/Tag.styled.js +4 -4
- package/dist/cjs/components/tag/Tag.styled.js.map +1 -1
- package/dist/cjs/components/tag/model.js.map +1 -1
- package/dist/cjs/icons/BIK AI specific/WandSparkles.js +1 -1
- package/dist/cjs/icons/BIK AI specific/WandSparkles.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/button/Button.js +19 -21
- package/dist/esm/components/button/Button.js.map +1 -1
- package/dist/esm/components/button/Button.styled.d.ts +0 -1
- package/dist/esm/components/button/Button.styled.js +5 -5
- package/dist/esm/components/button/Button.styled.js.map +1 -1
- package/dist/esm/components/button/model.d.ts +0 -5
- package/dist/esm/components/chip-selector/ChipSelector.d.ts +9 -0
- package/dist/esm/components/chip-selector/ChipSelector.js +27 -0
- package/dist/esm/components/chip-selector/ChipSelector.js.map +1 -0
- package/dist/esm/components/chip-selector/ChipSelector.styled.d.ts +10 -0
- package/dist/esm/components/chip-selector/ChipSelector.styled.js +48 -0
- package/dist/esm/components/chip-selector/ChipSelector.styled.js.map +1 -0
- package/dist/esm/components/chip-selector/ChipSelectorGroup.d.ts +10 -0
- package/dist/esm/components/chip-selector/ChipSelectorGroup.js +48 -0
- package/dist/esm/components/chip-selector/ChipSelectorGroup.js.map +1 -0
- package/dist/esm/components/chip-selector/index.d.ts +4 -0
- package/dist/esm/components/chip-selector/model.d.ts +106 -0
- package/dist/esm/components/combo-box/ComboBox.d.ts +15 -0
- package/dist/esm/components/combo-box/ComboBox.js +118 -0
- package/dist/esm/components/combo-box/ComboBox.js.map +1 -0
- package/dist/esm/components/combo-box/ComboBox.styled.d.ts +12 -0
- package/dist/esm/components/combo-box/ComboBox.styled.js +40 -0
- package/dist/esm/components/combo-box/ComboBox.styled.js.map +1 -0
- package/dist/esm/components/combo-box/index.d.ts +3 -0
- package/dist/esm/components/combo-box/model.d.ts +55 -0
- package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +7 -0
- package/dist/esm/components/datePicker/DatePickerWrapper.js +66 -64
- package/dist/esm/components/datePicker/DatePickerWrapper.js.map +1 -1
- package/dist/esm/components/datePicker/index.d.ts +1 -0
- package/dist/esm/components/dropdown-button/DropdownButton.d.ts +0 -5
- package/dist/esm/components/dropdown-button/DropdownButton.js +3 -4
- package/dist/esm/components/dropdown-button/DropdownButton.js.map +1 -1
- package/dist/esm/components/schedule-builder/RefreshSegmentToggle.d.ts +22 -0
- package/dist/esm/components/schedule-builder/RefreshSegmentToggle.js +31 -0
- package/dist/esm/components/schedule-builder/RefreshSegmentToggle.js.map +1 -0
- package/dist/esm/components/schedule-builder/ScheduleBuilder.d.ts +79 -0
- package/dist/esm/components/schedule-builder/ScheduleBuilder.js +103 -0
- package/dist/esm/components/schedule-builder/ScheduleBuilder.js.map +1 -0
- package/dist/esm/components/schedule-builder/ScheduleBuilder.styled.d.ts +81 -0
- package/dist/esm/components/schedule-builder/ScheduleBuilder.styled.js +168 -0
- package/dist/esm/components/schedule-builder/ScheduleBuilder.styled.js.map +1 -0
- package/dist/esm/components/schedule-builder/ScheduleEndPicker.d.ts +17 -0
- package/dist/esm/components/schedule-builder/ScheduleEndPicker.js +105 -0
- package/dist/esm/components/schedule-builder/ScheduleEndPicker.js.map +1 -0
- package/dist/esm/components/schedule-builder/ScheduleFrequencyPicker.d.ts +21 -0
- package/dist/esm/components/schedule-builder/ScheduleFrequencyPicker.js +136 -0
- package/dist/esm/components/schedule-builder/ScheduleFrequencyPicker.js.map +1 -0
- package/dist/esm/components/schedule-builder/ScheduleHelper.d.ts +110 -0
- package/dist/esm/components/schedule-builder/ScheduleHelper.js +196 -0
- package/dist/esm/components/schedule-builder/ScheduleHelper.js.map +1 -0
- package/dist/esm/components/schedule-builder/SendModeSelector.d.ts +21 -0
- package/dist/esm/components/schedule-builder/SendModeSelector.js +39 -0
- package/dist/esm/components/schedule-builder/SendModeSelector.js.map +1 -0
- package/dist/esm/components/schedule-builder/StartDateTimePicker.d.ts +44 -0
- package/dist/esm/components/schedule-builder/StartDateTimePicker.js +119 -0
- package/dist/esm/components/schedule-builder/StartDateTimePicker.js.map +1 -0
- package/dist/esm/components/schedule-builder/UpcomingRunsPreview.d.ts +19 -0
- package/dist/esm/components/schedule-builder/UpcomingRunsPreview.js +44 -0
- package/dist/esm/components/schedule-builder/UpcomingRunsPreview.js.map +1 -0
- package/dist/esm/components/schedule-builder/index.d.ts +17 -0
- package/dist/esm/components/schedule-builder/model.d.ts +69 -0
- package/dist/esm/components/schedule-builder/model.js +8 -0
- package/dist/esm/components/schedule-builder/model.js.map +1 -0
- package/dist/esm/components/tag/Tag.d.ts +1 -1
- package/dist/esm/components/tag/Tag.js +41 -48
- package/dist/esm/components/tag/Tag.js.map +1 -1
- package/dist/esm/components/tag/Tag.styled.d.ts +0 -3
- package/dist/esm/components/tag/Tag.styled.js +9 -6
- package/dist/esm/components/tag/Tag.styled.js.map +1 -1
- package/dist/esm/components/tag/model.d.ts +0 -11
- package/dist/esm/components/tag/model.js.map +1 -1
- package/dist/esm/icons/BIK AI specific/WandSparkles.js +1 -1
- package/dist/esm/icons/BIK AI specific/WandSparkles.js.map +1 -1
- package/dist/esm/icons/index.d.ts +25 -25
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +618 -577
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,83 +1,85 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { jsxs as p, Fragment as A, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { format as P } from "date-fns";
|
|
3
|
+
import { useState as R, useRef as y } from "react";
|
|
4
|
+
import L from "react-calendar";
|
|
5
|
+
import { useOutside as x } from "../../hooks/useOutside.js";
|
|
6
|
+
import E from "../../utils/DateUtils.js";
|
|
6
7
|
import { COLORS as r } from "../../constants/Theme.js";
|
|
7
|
-
import
|
|
8
|
-
import { BodyPrimary as
|
|
9
|
-
import { DateBtn as
|
|
10
|
-
import { DateButtonType as
|
|
11
|
-
const
|
|
12
|
-
val:
|
|
13
|
-
onChange:
|
|
14
|
-
calendarProps:
|
|
15
|
-
disabled:
|
|
16
|
-
pickerStyles:
|
|
17
|
-
nativeID:
|
|
18
|
-
maxDate:
|
|
19
|
-
minDate:
|
|
20
|
-
dateButtonType:
|
|
21
|
-
dateButtonStyles:
|
|
8
|
+
import O from "../../assets/icons/calendar.svg.js";
|
|
9
|
+
import { BodyPrimary as _, BodySecondary as $ } from "../TypographyStyle.js";
|
|
10
|
+
import { DateBtn as G, PickerContainer as j } from "./DatePickerWrapper.styled.js";
|
|
11
|
+
import { DateButtonType as c } from "./model.js";
|
|
12
|
+
const K = ({
|
|
13
|
+
val: e,
|
|
14
|
+
onChange: D,
|
|
15
|
+
calendarProps: g,
|
|
16
|
+
disabled: o,
|
|
17
|
+
pickerStyles: d,
|
|
18
|
+
nativeID: C,
|
|
19
|
+
maxDate: h,
|
|
20
|
+
minDate: w,
|
|
21
|
+
dateButtonType: i,
|
|
22
|
+
dateButtonStyles: k,
|
|
23
|
+
displayFormat: m,
|
|
24
|
+
placeholder: S
|
|
22
25
|
}) => {
|
|
23
|
-
const [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
const [f, s] = R(!1), b = y(null), l = y(null);
|
|
27
|
+
x(l, () => {
|
|
28
|
+
s(!1);
|
|
26
29
|
});
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
)
|
|
30
|
-
/* @__PURE__ */ new Date()
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
E,
|
|
30
|
+
const t = (a) => m ? P(a, m) : a.toLocaleDateString(), u = () => e ? Array.isArray(e) ? e?.[0]?.toString() && e?.[1]?.toString() ? `${t(new Date(e[0].toString()))}-${t(
|
|
31
|
+
new Date(e[1].toString())
|
|
32
|
+
)}` : `${t(E.getPastDate(/* @__PURE__ */ new Date(), 30))}-${t(
|
|
33
|
+
/* @__PURE__ */ new Date()
|
|
34
|
+
)}` : t(new Date(e.toString())) : S ?? t(/* @__PURE__ */ new Date());
|
|
35
|
+
return /* @__PURE__ */ p(A, { children: [
|
|
36
|
+
/* @__PURE__ */ p(
|
|
37
|
+
G,
|
|
36
38
|
{
|
|
37
|
-
id:
|
|
38
|
-
ref:
|
|
39
|
-
bgColor:
|
|
39
|
+
id: C,
|
|
40
|
+
ref: b,
|
|
41
|
+
bgColor: o ? r.background.base : r.surface.standard,
|
|
40
42
|
borderColor: r.stroke.primary,
|
|
41
|
-
onClick: () =>
|
|
42
|
-
dateButtonType:
|
|
43
|
-
style:
|
|
43
|
+
onClick: () => s(!f),
|
|
44
|
+
dateButtonType: i || c.DEFAULT,
|
|
45
|
+
style: k,
|
|
44
46
|
children: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
i === c.LARGE ? /* @__PURE__ */ n(
|
|
48
|
+
_,
|
|
47
49
|
{
|
|
48
50
|
style: {
|
|
49
|
-
color:
|
|
51
|
+
color: o ? r.content.inactive : r.content.primary,
|
|
50
52
|
flex: 1
|
|
51
53
|
},
|
|
52
|
-
children:
|
|
54
|
+
children: u()
|
|
53
55
|
}
|
|
54
|
-
) : /* @__PURE__ */
|
|
55
|
-
|
|
56
|
+
) : /* @__PURE__ */ n(
|
|
57
|
+
$,
|
|
56
58
|
{
|
|
57
59
|
style: {
|
|
58
|
-
color:
|
|
60
|
+
color: o ? r.content.inactive : r.content.primary,
|
|
59
61
|
flex: 1
|
|
60
62
|
},
|
|
61
|
-
children:
|
|
63
|
+
children: u()
|
|
62
64
|
}
|
|
63
65
|
),
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
|
|
66
|
+
/* @__PURE__ */ n(
|
|
67
|
+
O,
|
|
66
68
|
{
|
|
67
|
-
width:
|
|
68
|
-
height:
|
|
69
|
-
color:
|
|
69
|
+
width: i === c.LARGE ? 24 : 20,
|
|
70
|
+
height: i === c.LARGE ? 24 : 20,
|
|
71
|
+
color: o ? r.content.inactive : r.content.primary
|
|
70
72
|
}
|
|
71
73
|
)
|
|
72
74
|
]
|
|
73
75
|
}
|
|
74
76
|
),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
f && !o && /* @__PURE__ */ n(
|
|
78
|
+
j,
|
|
77
79
|
{
|
|
78
|
-
ref:
|
|
80
|
+
ref: l,
|
|
79
81
|
style: {
|
|
80
|
-
...
|
|
82
|
+
...d
|
|
81
83
|
// top: openUpwards ? 'auto' : 'calc(100% + 8px)',
|
|
82
84
|
// bottom: openUpwards ? 'calc(100% + 8px)' : 'auto',
|
|
83
85
|
},
|
|
@@ -86,18 +88,18 @@ const q = ({
|
|
|
86
88
|
brandColor: r.background.brand,
|
|
87
89
|
bgColor: r.surface.standard,
|
|
88
90
|
borderColor: r.stroke.primary,
|
|
89
|
-
children: /* @__PURE__ */
|
|
90
|
-
|
|
91
|
+
children: /* @__PURE__ */ n(
|
|
92
|
+
L,
|
|
91
93
|
{
|
|
92
94
|
tileClassName: ["custom__tile"],
|
|
93
95
|
className: ["custom__calendar"],
|
|
94
|
-
onChange: (
|
|
95
|
-
|
|
96
|
+
onChange: (a) => {
|
|
97
|
+
D(a), s(!1);
|
|
96
98
|
},
|
|
97
|
-
maxDate:
|
|
98
|
-
minDate:
|
|
99
|
-
value:
|
|
100
|
-
...
|
|
99
|
+
maxDate: h,
|
|
100
|
+
minDate: w,
|
|
101
|
+
value: e ? Array.isArray(e) ? e.length === 2 ? [new Date(e[0]), new Date(e[1])] : null : new Date(e) : null,
|
|
102
|
+
...g
|
|
101
103
|
}
|
|
102
104
|
)
|
|
103
105
|
}
|
|
@@ -105,6 +107,6 @@ const q = ({
|
|
|
105
107
|
] });
|
|
106
108
|
};
|
|
107
109
|
export {
|
|
108
|
-
|
|
110
|
+
K as DatePickerWrapper
|
|
109
111
|
};
|
|
110
112
|
//# sourceMappingURL=DatePickerWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerWrapper.js","sources":["../../../../src/components/datePicker/DatePickerWrapper.tsx"],"sourcesContent":["import React, { useRef, useState } from 'react';\nimport Calendar, { CalendarProps } from 'react-calendar';\nimport { CSSProperties } from 'styled-components';\nimport { useOutside } from '@src/hooks/useOutside';\nimport DateUtils from '@src/utils/DateUtils';\nimport { COLORS } from '@src/constants/Theme';\nimport CalendarIcon from '../../assets/icons/calendar.svg';\nimport { BodyPrimary, BodySecondary } from '../TypographyStyle';\nimport { DateBtn, PickerContainer } from './DatePickerWrapper.styled';\nimport { DateButtonType } from './model';\n\nexport const DatePickerWrapper: React.FC<{\n\tval?: Date | Date[];\n\tonChange: (val: Date | Date[]) => void;\n\tcalendarProps?: CalendarProps;\n\tpickerStyles?: CSSProperties;\n\tdateButtonStyles?: CSSProperties;\n\tnativeID?: string;\n\tdisabled?: boolean;\n\tmaxDate?: Date;\n\tminDate?: Date;\n\tdateButtonType?: DateButtonType;\n}> = ({\n\tval,\n\tonChange,\n\tcalendarProps,\n\tdisabled,\n\tpickerStyles,\n\tnativeID,\n\tmaxDate,\n\tminDate,\n\tdateButtonType,\n\tdateButtonStyles,\n}) => {\n\tconst [showPicker, setPicker] = useState(false);\n\t// const [openUpwards, setOpenUpwards] = useState(false);\n\tconst buttonRef = useRef<HTMLDivElement | null>(null);\n\tconst pickerRef = useRef<HTMLDivElement | null>(null);\n\n\tuseOutside(pickerRef, () => {\n\t\tsetPicker(false);\n\t});\n\n\t// useEffect(() => {\n\t// \tif (buttonRef.current && pickerRef.current) {\n\t// \t\tconst buttonRect = buttonRef.current.getBoundingClientRect();\n\t// \t\tconst pickerHeight = pickerRef.current.offsetHeight;\n\t// \t\tconst spaceBelow = window.innerHeight - buttonRect.bottom;\n\n\t// \t\t// If not enough space below, open upwards\n\t// \t\tsetOpenUpwards(spaceBelow < pickerHeight);\n\t// \t}\n\t// }, [showPicker]);\n\n\tconst getDisplayValue = () => {\n\t\
|
|
1
|
+
{"version":3,"file":"DatePickerWrapper.js","sources":["../../../../src/components/datePicker/DatePickerWrapper.tsx"],"sourcesContent":["import { format as formatDate } from 'date-fns';\nimport React, { useRef, useState } from 'react';\nimport Calendar, { CalendarProps } from 'react-calendar';\nimport { CSSProperties } from 'styled-components';\nimport { useOutside } from '@src/hooks/useOutside';\nimport DateUtils from '@src/utils/DateUtils';\nimport { COLORS } from '@src/constants/Theme';\nimport CalendarIcon from '../../assets/icons/calendar.svg';\nimport { BodyPrimary, BodySecondary } from '../TypographyStyle';\nimport { DateBtn, PickerContainer } from './DatePickerWrapper.styled';\nimport { DateButtonType } from './model';\n\nexport const DatePickerWrapper: React.FC<{\n\tval?: Date | Date[];\n\tonChange: (val: Date | Date[]) => void;\n\tcalendarProps?: CalendarProps;\n\tpickerStyles?: CSSProperties;\n\tdateButtonStyles?: CSSProperties;\n\tnativeID?: string;\n\tdisabled?: boolean;\n\tmaxDate?: Date;\n\tminDate?: Date;\n\tdateButtonType?: DateButtonType;\n\t/**\n\t * date-fns format for the button label, e.g. 'dd MMM yyyy' -> \"10 Aug 2026\".\n\t * Omit to keep the locale default (toLocaleDateString).\n\t */\n\tdisplayFormat?: string;\n\t/** Shown instead of a date when `val` is empty. */\n\tplaceholder?: string;\n}> = ({\n\tval,\n\tonChange,\n\tcalendarProps,\n\tdisabled,\n\tpickerStyles,\n\tnativeID,\n\tmaxDate,\n\tminDate,\n\tdateButtonType,\n\tdateButtonStyles,\n\tdisplayFormat,\n\tplaceholder,\n}) => {\n\tconst [showPicker, setPicker] = useState(false);\n\t// const [openUpwards, setOpenUpwards] = useState(false);\n\tconst buttonRef = useRef<HTMLDivElement | null>(null);\n\tconst pickerRef = useRef<HTMLDivElement | null>(null);\n\n\tuseOutside(pickerRef, () => {\n\t\tsetPicker(false);\n\t});\n\n\t// useEffect(() => {\n\t// \tif (buttonRef.current && pickerRef.current) {\n\t// \t\tconst buttonRect = buttonRef.current.getBoundingClientRect();\n\t// \t\tconst pickerHeight = pickerRef.current.offsetHeight;\n\t// \t\tconst spaceBelow = window.innerHeight - buttonRect.bottom;\n\n\t// \t\t// If not enough space below, open upwards\n\t// \t\tsetOpenUpwards(spaceBelow < pickerHeight);\n\t// \t}\n\t// }, [showPicker]);\n\n\t/** Honours `displayFormat` when given, else the locale default. */\n\tconst formatOne = (date: Date) =>\n\t\tdisplayFormat ? formatDate(date, displayFormat) : date.toLocaleDateString();\n\n\tconst getDisplayValue = () => {\n\t\tif (!val) {\n\t\t\treturn placeholder ?? formatOne(new Date());\n\t\t}\n\n\t\tif (Array.isArray(val)) {\n\t\t\treturn val?.[0]?.toString() && val?.[1]?.toString()\n\t\t\t\t? `${formatOne(new Date(val[0].toString()))}-${formatOne(\n\t\t\t\t\t\tnew Date(val[1].toString()),\n\t\t\t\t )}`\n\t\t\t\t: `${formatOne(DateUtils.getPastDate(new Date(), 30))}-${formatOne(\n\t\t\t\t\t\tnew Date(),\n\t\t\t\t )}`;\n\t\t}\n\n\t\treturn formatOne(new Date(val.toString()));\n\t};\n\treturn (\n\t\t<>\n\t\t\t<DateBtn\n\t\t\t\tid={nativeID}\n\t\t\t\tref={buttonRef}\n\t\t\t\tbgColor={disabled ? COLORS.background.base : COLORS.surface.standard}\n\t\t\t\tborderColor={COLORS.stroke.primary}\n\t\t\t\tonClick={() => setPicker(!showPicker)}\n\t\t\t\tdateButtonType={dateButtonType || DateButtonType.DEFAULT}\n\t\t\t\tstyle={dateButtonStyles}\n\t\t\t>\n\t\t\t\t{dateButtonType === DateButtonType.LARGE ? (\n\t\t\t\t\t<BodyPrimary\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tcolor: disabled\n\t\t\t\t\t\t\t\t? COLORS.content.inactive\n\t\t\t\t\t\t\t\t: COLORS.content.primary,\n\t\t\t\t\t\t\tflex: 1,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{getDisplayValue()}\n\t\t\t\t\t</BodyPrimary>\n\t\t\t\t) : (\n\t\t\t\t\t<BodySecondary\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tcolor: disabled\n\t\t\t\t\t\t\t\t? COLORS.content.inactive\n\t\t\t\t\t\t\t\t: COLORS.content.primary,\n\t\t\t\t\t\t\tflex: 1,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{getDisplayValue()}\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t)}\n\t\t\t\t<CalendarIcon\n\t\t\t\t\twidth={dateButtonType === DateButtonType.LARGE ? 24 : 20}\n\t\t\t\t\theight={dateButtonType === DateButtonType.LARGE ? 24 : 20}\n\t\t\t\t\tcolor={disabled ? COLORS.content.inactive : COLORS.content.primary}\n\t\t\t\t/>\n\t\t\t</DateBtn>\n\t\t\t{showPicker && !disabled && (\n\t\t\t\t<PickerContainer\n\t\t\t\t\tref={\n\t\t\t\t\t\tpickerRef as\n\t\t\t\t\t\t\t| ((instance: HTMLDivElement | null) => void)\n\t\t\t\t\t\t\t| React.RefObject<HTMLDivElement>\n\t\t\t\t\t\t\t| null\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t...pickerStyles,\n\t\t\t\t\t\t// top: openUpwards ? 'auto' : 'calc(100% + 8px)',\n\t\t\t\t\t\t// bottom: openUpwards ? 'calc(100% + 8px)' : 'auto',\n\t\t\t\t\t}}\n\t\t\t\t\tcontentPrimary={COLORS.content.primary}\n\t\t\t\t\tsubDued={COLORS.surface.subdued}\n\t\t\t\t\tbrandColor={COLORS.background.brand}\n\t\t\t\t\tbgColor={COLORS.surface.standard}\n\t\t\t\t\tborderColor={COLORS.stroke.primary}\n\t\t\t\t>\n\t\t\t\t\t<Calendar\n\t\t\t\t\t\ttileClassName={['custom__tile']}\n\t\t\t\t\t\tclassName={['custom__calendar']}\n\t\t\t\t\t\tonChange={(d) => {\n\t\t\t\t\t\t\tonChange(d);\n\t\t\t\t\t\t\tsetPicker(false);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tmaxDate={maxDate}\n\t\t\t\t\t\tminDate={minDate}\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tval\n\t\t\t\t\t\t\t\t? Array.isArray(val)\n\t\t\t\t\t\t\t\t\t? val.length === 2\n\t\t\t\t\t\t\t\t\t\t? [new Date(val[0]), new Date(val[1])]\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t\t: new Date(val)\n\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{...calendarProps}\n\t\t\t\t\t/>\n\t\t\t\t</PickerContainer>\n\t\t\t)}\n\t\t</>\n\t);\n};\n"],"names":["DatePickerWrapper","val","onChange","calendarProps","disabled","pickerStyles","nativeID","maxDate","minDate","dateButtonType","dateButtonStyles","displayFormat","placeholder","showPicker","setPicker","useState","buttonRef","useRef","pickerRef","useOutside","formatOne","date","formatDate","getDisplayValue","DateUtils","jsxs","Fragment","DateBtn","COLORS","DateButtonType","jsx","BodyPrimary","BodySecondary","CalendarIcon","PickerContainer","Calendar","d"],"mappings":";;;;;;;;;;;AAYO,MAAMA,IAkBR,CAAC;AAAA,EACL,KAAAC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,YAChB;AAAA,YACA,SAAAP;AAAA,YACA,SAAAC;AAAA,YACA,OACCP,IACG,MAAM,QAAQA,CAAG,IAChBA,EAAI,WAAW,IACd,CAAC,IAAI,KAAKA,EAAI,CAAC,CAAC,GAAG,IAAI,KAAKA,EAAI,CAAC,CAAC,CAAC,IACnC,OACD,IAAI,KAAKA,CAAG,IACb;AAAA,YAEH,GAAGE;AAAA,UAAA;AAAA,QAAA;AAAA,MACL;AAAA,IAAA;AAAA,EACD,GAEF;AAEF;"}
|
|
@@ -17,10 +17,5 @@ export interface DropdownButtonProps {
|
|
|
17
17
|
tooltipContent?: JSX.Element;
|
|
18
18
|
placement?: Placement;
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
21
|
-
* Style overrides for the chevron/trigger button (button mode only),
|
|
22
|
-
* e.g. a tighter padding than the main button's.
|
|
23
|
-
*/
|
|
24
|
-
chevronStyle?: React.CSSProperties;
|
|
25
20
|
}
|
|
26
21
|
export declare const DropdownButton: React.FC<DropdownButtonProps>;
|
|
@@ -6,7 +6,7 @@ import { IconButton as l } from "../icon-button/IconButton.js";
|
|
|
6
6
|
import { Tooltip as x } from "../tooltips/Tooltip.js";
|
|
7
7
|
import { Spinner as y } from "../spinner/Spinner.js";
|
|
8
8
|
import { Button as b } from "../button/Button.js";
|
|
9
|
-
const
|
|
9
|
+
const S = (o) => {
|
|
10
10
|
const e = !!o.iconButtonProps, r = e ? o.iconButtonProps?.disabled : o.buttonProps?.disabled;
|
|
11
11
|
if (e) {
|
|
12
12
|
const { iconButtonProps: n, iconButtonTooltip: i } = o, d = /* @__PURE__ */ t(
|
|
@@ -115,8 +115,7 @@ const w = (o) => {
|
|
|
115
115
|
borderRadius: "0px",
|
|
116
116
|
borderTopRightRadius: "4px",
|
|
117
117
|
borderBottomRightRadius: "4px",
|
|
118
|
-
...o.buttonProps?.size === "xs" ? { border: "none", boxShadow: "none", borderRadius: "0px" } : {}
|
|
119
|
-
...o.chevronStyle ?? {}
|
|
118
|
+
...o.buttonProps?.size === "xs" ? { border: "none", boxShadow: "none", borderRadius: "0px" } : {}
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
121
|
)
|
|
@@ -127,6 +126,6 @@ const w = (o) => {
|
|
|
127
126
|
);
|
|
128
127
|
};
|
|
129
128
|
export {
|
|
130
|
-
|
|
129
|
+
S as DropdownButton
|
|
131
130
|
};
|
|
132
131
|
//# sourceMappingURL=DropdownButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownButton.js","sources":["../../../../src/components/dropdown-button/DropdownButton.tsx"],"sourcesContent":["import React from 'react';\nimport { DropdownPopover, DropdownProps } from '@src/components/dropdown';\nimport { Button } from '../button';\nimport { ButtonProps } from '../button/model';\nimport { SpinnerColorMap } from '../button/themes';\nimport { IconButton } from '../icon-button';\nimport { IconButtonProps } from '../icon-button/model';\nimport { Spinner } from '../spinner';\nimport { Placement, Tooltip } from '../tooltips';\nimport { DropdownButtonStyle, LoaderContainer } from './DropdownButton.style';\n\nexport interface DropdownButtonProps {\n\tdropdownProps: DropdownProps;\n\ticonProps: React.FunctionComponent<React.SVGAttributes<SVGElement>>;\n\tbuttonProps?: ButtonProps;\n\ticonButtonProps?: IconButtonProps;\n\t/**\n\t * Optional tooltip shown only on the main icon button (icon mode),\n\t * not on the dropdown/chevron trigger.\n\t */\n\ticonButtonTooltip?: {\n\t\tbody?: string;\n\t\ttooltipContent?: JSX.Element;\n\t\tplacement?: Placement;\n\t};\n
|
|
1
|
+
{"version":3,"file":"DropdownButton.js","sources":["../../../../src/components/dropdown-button/DropdownButton.tsx"],"sourcesContent":["import React from 'react';\nimport { DropdownPopover, DropdownProps } from '@src/components/dropdown';\nimport { Button } from '../button';\nimport { ButtonProps } from '../button/model';\nimport { SpinnerColorMap } from '../button/themes';\nimport { IconButton } from '../icon-button';\nimport { IconButtonProps } from '../icon-button/model';\nimport { Spinner } from '../spinner';\nimport { Placement, Tooltip } from '../tooltips';\nimport { DropdownButtonStyle, LoaderContainer } from './DropdownButton.style';\n\nexport interface DropdownButtonProps {\n\tdropdownProps: DropdownProps;\n\ticonProps: React.FunctionComponent<React.SVGAttributes<SVGElement>>;\n\tbuttonProps?: ButtonProps;\n\ticonButtonProps?: IconButtonProps;\n\t/**\n\t * Optional tooltip shown only on the main icon button (icon mode),\n\t * not on the dropdown/chevron trigger.\n\t */\n\ticonButtonTooltip?: {\n\t\tbody?: string;\n\t\ttooltipContent?: JSX.Element;\n\t\tplacement?: Placement;\n\t};\n}\n\nexport const DropdownButton: React.FC<DropdownButtonProps> = (props) => {\n\tconst isIconMode = !!props.iconButtonProps;\n\tconst disabled = isIconMode\n\t\t? props.iconButtonProps?.disabled\n\t\t: props.buttonProps?.disabled;\n\n\tif (isIconMode) {\n\t\tconst { iconButtonProps, iconButtonTooltip } = props;\n\t\tconst iconButton = (\n\t\t\t<IconButton\n\t\t\t\t{...iconButtonProps!}\n\t\t\t\tstyle={{\n\t\t\t\t\tborderRadius: '0px',\n\t\t\t\t\tborderTopLeftRadius: '4px',\n\t\t\t\t\tborderBottomLeftRadius: '4px',\n\t\t\t\t}}\n\t\t\t/>\n\t\t);\n\t\treturn (\n\t\t\t<DropdownButtonStyle\n\t\t\t\ttype={undefined}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tisIconButton\n\t\t\t\ticonButtonType={iconButtonProps?.iconButtonType ?? 'primary'}\n\t\t\t\ticonButtonSize={iconButtonProps?.size ?? 'default'}\n\t\t\t>\n\t\t\t\t{iconButtonTooltip ? (\n\t\t\t\t\t<Tooltip\n\t\t\t\t\t\tbody={iconButtonTooltip.body}\n\t\t\t\t\t\ttooltipContent={iconButtonTooltip.tooltipContent}\n\t\t\t\t\t\tplacement={iconButtonTooltip.placement}\n\t\t\t\t\t>\n\t\t\t\t\t\t{iconButton}\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) : (\n\t\t\t\t\ticonButton\n\t\t\t\t)}\n\t\t\t\t<div className=\"dd-button-divider\"></div>\n\t\t\t\t<div style={{ display: 'flex', alignItems: 'center' }}>\n\t\t\t\t\t<DropdownPopover {...props.dropdownProps} isChildLoading={false}>\n\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\tIcon={props.iconProps}\n\t\t\t\t\t\t\ticonButtonType={iconButtonProps?.iconButtonType ?? 'primary'}\n\t\t\t\t\t\t\tsize={iconButtonProps?.size}\n\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\tborderRadius: '0px',\n\t\t\t\t\t\t\t\tborderTopRightRadius: '4px',\n\t\t\t\t\t\t\t\tborderBottomRightRadius: '4px',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</DropdownPopover>\n\t\t\t\t</div>\n\t\t\t</DropdownButtonStyle>\n\t\t);\n\t}\n\n\tconst {\n\t\tonClick,\n\t\tLeadingIcon,\n\t\tLeadingIconStyles,\n\t\tIconComponent,\n\t\tTrailingIcon,\n\t\t...childButtonProps\n\t} = props.buttonProps!;\n\n\treturn (\n\t\t<DropdownButtonStyle\n\t\t\ttype={props.buttonProps!.buttonType}\n\t\t\tdisabled={props.buttonProps!.disabled}\n\t\t\tsize={props.buttonProps!.size}\n\t\t>\n\t\t\t{props.buttonProps?.isLoading && (\n\t\t\t\t<LoaderContainer type={props.buttonProps.buttonType}>\n\t\t\t\t\t<Spinner\n\t\t\t\t\t\tclassName=\"spinner\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tcolor={SpinnerColorMap(\n\t\t\t\t\t\t\tprops.buttonProps.buttonType || 'primary',\n\t\t\t\t\t\t\tprops.buttonProps.inverse,\n\t\t\t\t\t\t)}\n\t\t\t\t\t/>\n\t\t\t\t</LoaderContainer>\n\t\t\t)}\n\n\t\t\t<Button\n\t\t\t\t{...props.buttonProps!}\n\t\t\t\tisLoading={false}\n\t\t\t\tstyle={{\n\t\t\t\t\tborderRadius: '0px',\n\t\t\t\t\tborderTopLeftRadius: '4px',\n\t\t\t\t\tborderBottomLeftRadius: '4px',\n\t\t\t\t\tborderRight: '0px',\n\t\t\t\t\t...(props.buttonProps?.size === 'xs'\n\t\t\t\t\t\t? { border: 'none', boxShadow: 'none', borderRadius: '0px' }\n\t\t\t\t\t\t: {}),\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<div className=\"dd-button-divider\"></div>\n\t\t\t<DropdownPopover\n\t\t\t\t{...props.dropdownProps}\n\t\t\t\tisChildLoading={props.buttonProps?.isLoading}\n\t\t\t>\n\t\t\t\t<Button\n\t\t\t\t\t{...childButtonProps}\n\t\t\t\t\tisLoading={false}\n\t\t\t\t\tbuttonText={''}\n\t\t\t\t\tTrailingIcon={props.iconProps}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tborderRadius: '0px',\n\t\t\t\t\t\tborderTopRightRadius: '4px',\n\t\t\t\t\t\tborderBottomRightRadius: '4px',\n\t\t\t\t\t\t...(props.buttonProps?.size === 'xs'\n\t\t\t\t\t\t\t? { border: 'none', boxShadow: 'none', borderRadius: '0px' }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</DropdownPopover>\n\t\t</DropdownButtonStyle>\n\t);\n};\n"],"names":["DropdownButton","props","isIconMode","disabled","iconButtonProps","iconButtonTooltip","iconButton","jsx","IconButton","jsxs","DropdownButtonStyle","Tooltip","DropdownPopover","onClick","LeadingIcon","LeadingIconStyles","IconComponent","TrailingIcon","childButtonProps","LoaderContainer","Spinner","SpinnerColorMap","Button"],"mappings":";;;;;;;;AA2BO,MAAMA,IAAgD,CAACC,MAAU;AACvE,QAAMC,IAAa,CAAC,CAACD,EAAM,iBACrBE,IAAWD,IACdD,EAAM,iBAAiB,WACvBA,EAAM,aAAa;AAEtB,MAAIC,GAAY;AACf,UAAM,EAAE,iBAAAE,GAAiB,mBAAAC,EAAA,IAAsBJ,GACzCK,IACL,gBAAAC;AAAA,MA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AAAA,QAAA;AAAA,MACD;AAAA,IAAA;AAAA,EAAA;AAGH;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface RefreshSegmentToggleProps {
|
|
3
|
+
value: boolean;
|
|
4
|
+
onChange: (value: boolean) => void;
|
|
5
|
+
/**
|
|
6
|
+
* False when the audience cannot be recomputed — a static uploaded list, for
|
|
7
|
+
* instance. The switch reads off and goes inert rather than disappearing, so
|
|
8
|
+
* the merchant can see the option exists and is unavailable.
|
|
9
|
+
*/
|
|
10
|
+
canRefresh?: boolean;
|
|
11
|
+
title?: string;
|
|
12
|
+
caption?: string;
|
|
13
|
+
'data-test'?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* "Refresh segment before each run".
|
|
17
|
+
*
|
|
18
|
+
* Kept separate from the pickers because it is not part of the schedule — it
|
|
19
|
+
* decides how the audience is resolved at send time, and a screen may want the
|
|
20
|
+
* schedule without offering this at all.
|
|
21
|
+
*/
|
|
22
|
+
export declare const RefreshSegmentToggle: React.FC<RefreshSegmentToggleProps>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { COLORS as t } from "../../constants/Theme.js";
|
|
3
|
+
import { TitleSmall as h, BodyCaption as l } from "../TypographyStyle.js";
|
|
4
|
+
import { RefreshSegmentRow as f, RefreshSegmentCopy as d } from "./ScheduleBuilder.styled.js";
|
|
5
|
+
import { Switch as p } from "../switch/Switch.js";
|
|
6
|
+
const b = ({
|
|
7
|
+
value: n,
|
|
8
|
+
onChange: m,
|
|
9
|
+
canRefresh: r = !0,
|
|
10
|
+
title: s = "Refresh segment before each run",
|
|
11
|
+
caption: i = "Recomputes who is in the segment before each run",
|
|
12
|
+
"data-test": a = "refresh-segment-before-each-run"
|
|
13
|
+
}) => /* @__PURE__ */ o(f, { children: [
|
|
14
|
+
/* @__PURE__ */ o(d, { children: [
|
|
15
|
+
/* @__PURE__ */ e(h, { color: t.content.primary, children: s }),
|
|
16
|
+
/* @__PURE__ */ e(l, { color: t.content.secondary, children: i })
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ e(
|
|
19
|
+
p,
|
|
20
|
+
{
|
|
21
|
+
value: r && n,
|
|
22
|
+
disabled: !r,
|
|
23
|
+
onValueChange: async (c) => m(c),
|
|
24
|
+
"data-test": a
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
] });
|
|
28
|
+
export {
|
|
29
|
+
b as RefreshSegmentToggle
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=RefreshSegmentToggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshSegmentToggle.js","sources":["../../../../src/components/schedule-builder/RefreshSegmentToggle.tsx"],"sourcesContent":["import React from 'react';\nimport { COLORS } from '../../constants/Theme';\nimport { Switch } from '../switch';\nimport { BodyCaption, TitleSmall } from '../TypographyStyle';\nimport {\n\tRefreshSegmentCopy,\n\tRefreshSegmentRow,\n} from './ScheduleBuilder.styled';\n\nexport interface RefreshSegmentToggleProps {\n\tvalue: boolean;\n\tonChange: (value: boolean) => void;\n\t/**\n\t * False when the audience cannot be recomputed — a static uploaded list, for\n\t * instance. The switch reads off and goes inert rather than disappearing, so\n\t * the merchant can see the option exists and is unavailable.\n\t */\n\tcanRefresh?: boolean;\n\ttitle?: string;\n\tcaption?: string;\n\t'data-test'?: string;\n}\n\n/**\n * \"Refresh segment before each run\".\n *\n * Kept separate from the pickers because it is not part of the schedule — it\n * decides how the audience is resolved at send time, and a screen may want the\n * schedule without offering this at all.\n */\nexport const RefreshSegmentToggle: React.FC<RefreshSegmentToggleProps> = ({\n\tvalue,\n\tonChange,\n\tcanRefresh = true,\n\ttitle = 'Refresh segment before each run',\n\tcaption = 'Recomputes who is in the segment before each run',\n\t'data-test': dataTest = 'refresh-segment-before-each-run',\n}) => (\n\t<RefreshSegmentRow>\n\t\t<RefreshSegmentCopy>\n\t\t\t<TitleSmall color={COLORS.content.primary}>{title}</TitleSmall>\n\t\t\t<BodyCaption color={COLORS.content.secondary}>{caption}</BodyCaption>\n\t\t</RefreshSegmentCopy>\n\t\t<Switch\n\t\t\tvalue={canRefresh && value}\n\t\t\tdisabled={!canRefresh}\n\t\t\t// Switch's contract is async; this toggle is synchronous, so adapt rather\n\t\t\t// than push the Promise into every caller.\n\t\t\tonValueChange={async (next: boolean) => onChange(next)}\n\t\t\tdata-test={dataTest}\n\t\t/>\n\t</RefreshSegmentRow>\n);\n"],"names":["RefreshSegmentToggle","value","onChange","canRefresh","title","caption","dataTest","RefreshSegmentRow","jsxs","RefreshSegmentCopy","jsx","TitleSmall","COLORS","BodyCaption","Switch","next"],"mappings":";;;;;AA8BO,MAAMA,IAA4D,CAAC;AAAA,EACzE,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,aAAaC,IAAW;AACzB,wBACEC,GAAA,EACA,UAAA;AAAA,EAAA,gBAAAC,EAACC,GAAA,EACA,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAW,OAAOC,EAAO,QAAQ,SAAU,UAAAR,GAAM;AAAA,sBACjDS,GAAA,EAAY,OAAOD,EAAO,QAAQ,WAAY,UAAAP,EAAA,CAAQ;AAAA,EAAA,GACxD;AAAA,EACA,gBAAAK;AAAA,IAACI;AAAA,IAAA;AAAA,MACA,OAAOX,KAAcF;AAAA,MACrB,UAAU,CAACE;AAAA,MAGX,eAAe,OAAOY,MAAkBb,EAASa,CAAI;AAAA,MACrD,aAAWT;AAAA,IAAA;AAAA,EAAA;AACZ,EAAA,CACD;"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { RecurrenceValue, SEND_MODE } from './model';
|
|
3
|
+
import { SendModeItem } from './SendModeSelector';
|
|
4
|
+
export interface ScheduleBuilderProps {
|
|
5
|
+
/** Which mode is selected. Drives what is rendered below the cards. */
|
|
6
|
+
sendMode?: SEND_MODE;
|
|
7
|
+
onSendModeChange: (mode: SEND_MODE) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Modes on offer. Pass a subset to drop one — a screen that cannot send
|
|
10
|
+
* immediately should not show a "Send now" card it will reject.
|
|
11
|
+
*/
|
|
12
|
+
sendModeOptions?: SendModeItem<SEND_MODE>[];
|
|
13
|
+
/** The date the schedule starts from. For RECURRING it is the first run. */
|
|
14
|
+
date?: Date;
|
|
15
|
+
onDateChange: (date: Date) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Date the runs preview counts from, when it should differ from `date`.
|
|
18
|
+
*
|
|
19
|
+
* `date` follows the picker and changes the instant a day is clicked, which is
|
|
20
|
+
* usually too eager for the preview: a host validating the time separately does
|
|
21
|
+
* not want runs listed at a time that has not passed validation. Pass the
|
|
22
|
+
* validated value here and leave it undefined to hide the preview until then.
|
|
23
|
+
* Defaults to `date`.
|
|
24
|
+
*/
|
|
25
|
+
previewStartDate?: Date;
|
|
26
|
+
/** 12-hour clock, "1"–"12". Empty while nothing is chosen. */
|
|
27
|
+
hours: string;
|
|
28
|
+
/** "0"–"59". Empty while nothing is chosen. */
|
|
29
|
+
minutes: string;
|
|
30
|
+
isAm: boolean;
|
|
31
|
+
/** Fires only for a parseable time, so partial typing does not clear state. */
|
|
32
|
+
onTimeChange: (time: {
|
|
33
|
+
hours: string;
|
|
34
|
+
minutes: string;
|
|
35
|
+
}) => void;
|
|
36
|
+
onMeridiemChange: (isAm: boolean) => void;
|
|
37
|
+
onTimeInvalidBlur?: () => void;
|
|
38
|
+
/** Shown under the time field. The caller owns validation. */
|
|
39
|
+
timeErrorMessage?: string;
|
|
40
|
+
/** Earliest selectable date, normally now plus whatever lead time applies. */
|
|
41
|
+
minDate?: Date;
|
|
42
|
+
/** The recurrence. Only read when sendMode is RECURRING. */
|
|
43
|
+
recurrence?: RecurrenceValue;
|
|
44
|
+
/**
|
|
45
|
+
* Receives only the fields that changed, so a caller holding this in redux can
|
|
46
|
+
* dispatch one action per field instead of replacing the whole object.
|
|
47
|
+
*/
|
|
48
|
+
onRecurrenceChange: (patch: Partial<RecurrenceValue>) => void;
|
|
49
|
+
/** How many runs the preview lists. */
|
|
50
|
+
previewCount?: number;
|
|
51
|
+
/** Hide the runs preview, for a compact form that shows the summary elsewhere. */
|
|
52
|
+
hideUpcomingRuns?: boolean;
|
|
53
|
+
/** Greys out every control — an in-flight campaign that can no longer be moved. */
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
/** Menu width for the frequency dropdown; defaults to its button's width. */
|
|
56
|
+
frequencyMenuWidth?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Rendered between the send-mode cards and the fields. For anything a host
|
|
59
|
+
* screen wants inline that is not part of the schedule itself — a
|
|
60
|
+
* best-time-to-send card, a segment-refresh switch, a warning banner.
|
|
61
|
+
*/
|
|
62
|
+
children?: React.ReactNode;
|
|
63
|
+
'data-test'?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Picks when something sends — once, at a set time, or on a repeating schedule.
|
|
67
|
+
*
|
|
68
|
+
* Controlled and free of any app state: values in, change handlers out. It owns
|
|
69
|
+
* the send-mode cards, the date and time, and — for a repeating schedule — the
|
|
70
|
+
* frequency, what it repeats on, when it ends, and a preview of the next runs.
|
|
71
|
+
*
|
|
72
|
+
* Deliberately domain-neutral. Nothing about campaigns, audiences or sending
|
|
73
|
+
* lives here, so anything that needs a schedule can use it. Host-specific extras
|
|
74
|
+
* go through `children`, which renders below the mode cards.
|
|
75
|
+
*
|
|
76
|
+
* Every part is also exported on its own, for a screen that needs the end picker
|
|
77
|
+
* or the runs preview without the rest.
|
|
78
|
+
*/
|
|
79
|
+
export declare const ScheduleBuilder: React.FC<ScheduleBuilderProps>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsxs as m, jsx as e, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as s } from "react";
|
|
3
|
+
import { SEND_MODE as o } from "./model.js";
|
|
4
|
+
import { Column as u, SectionDivider as x } from "./ScheduleBuilder.styled.js";
|
|
5
|
+
import { ScheduleEndPicker as y } from "./ScheduleEndPicker.js";
|
|
6
|
+
import { ScheduleFrequencyPicker as G } from "./ScheduleFrequencyPicker.js";
|
|
7
|
+
import { ScheduleHelper as L, UPCOMING_RUNS_PREVIEW_COUNT as W } from "./ScheduleHelper.js";
|
|
8
|
+
import { SendModeSelector as j } from "./SendModeSelector.js";
|
|
9
|
+
import { StartDateTimePicker as H } from "./StartDateTimePicker.js";
|
|
10
|
+
import { UpcomingRunsPreview as M } from "./UpcomingRunsPreview.js";
|
|
11
|
+
const q = [
|
|
12
|
+
{ value: o.SEND_NOW, label: "Send now" },
|
|
13
|
+
{ value: o.SCHEDULE, label: "Schedule" },
|
|
14
|
+
{ value: o.RECURRING, label: "Set as recurring" }
|
|
15
|
+
], $ = ({
|
|
16
|
+
sendMode: r,
|
|
17
|
+
onSendModeChange: h,
|
|
18
|
+
sendModeOptions: E = q,
|
|
19
|
+
date: a,
|
|
20
|
+
onDateChange: f,
|
|
21
|
+
previewStartDate: c,
|
|
22
|
+
hours: N,
|
|
23
|
+
minutes: g,
|
|
24
|
+
isAm: D,
|
|
25
|
+
onTimeChange: R,
|
|
26
|
+
onMeridiemChange: U,
|
|
27
|
+
onTimeInvalidBlur: _,
|
|
28
|
+
timeErrorMessage: b,
|
|
29
|
+
minDate: v,
|
|
30
|
+
recurrence: t,
|
|
31
|
+
onRecurrenceChange: d,
|
|
32
|
+
previewCount: p = W,
|
|
33
|
+
hideUpcomingRuns: O = !1,
|
|
34
|
+
disabled: C = !1,
|
|
35
|
+
frequencyMenuWidth: P,
|
|
36
|
+
children: F,
|
|
37
|
+
"data-test": I = "schedule-builder"
|
|
38
|
+
}) => {
|
|
39
|
+
const l = r === o.RECURRING, T = !!r && r !== o.SEND_NOW, i = s(() => new L(t), [t]), S = c === void 0 ? a : c, n = s(
|
|
40
|
+
() => l ? i.computeUpcomingRuns(S, p) : [],
|
|
41
|
+
[i, S, p, l]
|
|
42
|
+
), k = s(
|
|
43
|
+
() => i.buildSummary(n),
|
|
44
|
+
[i, n]
|
|
45
|
+
);
|
|
46
|
+
return /* @__PURE__ */ m(u, { gap: 16, "data-test": I, children: [
|
|
47
|
+
/* @__PURE__ */ e(
|
|
48
|
+
j,
|
|
49
|
+
{
|
|
50
|
+
options: E,
|
|
51
|
+
value: r,
|
|
52
|
+
onChange: h,
|
|
53
|
+
disabled: C,
|
|
54
|
+
"data-test": "schedule-builder-send-mode"
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
F,
|
|
58
|
+
T && /* @__PURE__ */ m(w, { children: [
|
|
59
|
+
/* @__PURE__ */ e(x, {}),
|
|
60
|
+
/* @__PURE__ */ m(u, { gap: 12, children: [
|
|
61
|
+
/* @__PURE__ */ e(
|
|
62
|
+
H,
|
|
63
|
+
{
|
|
64
|
+
date: a,
|
|
65
|
+
onDateChange: f,
|
|
66
|
+
hours: N,
|
|
67
|
+
minutes: g,
|
|
68
|
+
isAm: D,
|
|
69
|
+
onTimeChange: R,
|
|
70
|
+
onMeridiemChange: U,
|
|
71
|
+
onTimeInvalidBlur: _,
|
|
72
|
+
timeErrorMessage: b,
|
|
73
|
+
dateLabel: l ? "Start date" : "Date",
|
|
74
|
+
minDate: v
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
l && /* @__PURE__ */ m(u, { gap: 12, "data-test": "schedule-builder-recurrence", children: [
|
|
78
|
+
/* @__PURE__ */ e(
|
|
79
|
+
G,
|
|
80
|
+
{
|
|
81
|
+
value: t ?? {},
|
|
82
|
+
onChange: d,
|
|
83
|
+
frequencyMenuWidth: P
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ e(
|
|
87
|
+
y,
|
|
88
|
+
{
|
|
89
|
+
value: t ?? {},
|
|
90
|
+
onChange: d,
|
|
91
|
+
minEndDate: a
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
!O && /* @__PURE__ */ e(M, { runs: n, summary: k })
|
|
95
|
+
] })
|
|
96
|
+
] })
|
|
97
|
+
] })
|
|
98
|
+
] });
|
|
99
|
+
};
|
|
100
|
+
export {
|
|
101
|
+
$ as ScheduleBuilder
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=ScheduleBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScheduleBuilder.js","sources":["../../../../src/components/schedule-builder/ScheduleBuilder.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { RecurrenceValue, SEND_MODE } from './model';\nimport { Column, SectionDivider } from './ScheduleBuilder.styled';\nimport { ScheduleEndPicker } from './ScheduleEndPicker';\nimport { ScheduleFrequencyPicker } from './ScheduleFrequencyPicker';\nimport { ScheduleHelper, UPCOMING_RUNS_PREVIEW_COUNT } from './ScheduleHelper';\nimport { SendModeItem, SendModeSelector } from './SendModeSelector';\nimport { StartDateTimePicker } from './StartDateTimePicker';\nimport { UpcomingRunsPreview } from './UpcomingRunsPreview';\n\n/** The modes offered when the caller does not name its own. */\nconst DEFAULT_SEND_MODE_OPTIONS: SendModeItem<SEND_MODE>[] = [\n\t{ value: SEND_MODE.SEND_NOW, label: 'Send now' },\n\t{ value: SEND_MODE.SCHEDULE, label: 'Schedule' },\n\t{ value: SEND_MODE.RECURRING, label: 'Set as recurring' },\n];\n\nexport interface ScheduleBuilderProps {\n\t/** Which mode is selected. Drives what is rendered below the cards. */\n\tsendMode?: SEND_MODE;\n\tonSendModeChange: (mode: SEND_MODE) => void;\n\t/**\n\t * Modes on offer. Pass a subset to drop one — a screen that cannot send\n\t * immediately should not show a \"Send now\" card it will reject.\n\t */\n\tsendModeOptions?: SendModeItem<SEND_MODE>[];\n\n\t/** The date the schedule starts from. For RECURRING it is the first run. */\n\tdate?: Date;\n\tonDateChange: (date: Date) => void;\n\t/**\n\t * Date the runs preview counts from, when it should differ from `date`.\n\t *\n\t * `date` follows the picker and changes the instant a day is clicked, which is\n\t * usually too eager for the preview: a host validating the time separately does\n\t * not want runs listed at a time that has not passed validation. Pass the\n\t * validated value here and leave it undefined to hide the preview until then.\n\t * Defaults to `date`.\n\t */\n\tpreviewStartDate?: Date;\n\n\t/** 12-hour clock, \"1\"–\"12\". Empty while nothing is chosen. */\n\thours: string;\n\t/** \"0\"–\"59\". Empty while nothing is chosen. */\n\tminutes: string;\n\tisAm: boolean;\n\t/** Fires only for a parseable time, so partial typing does not clear state. */\n\tonTimeChange: (time: { hours: string; minutes: string }) => void;\n\tonMeridiemChange: (isAm: boolean) => void;\n\tonTimeInvalidBlur?: () => void;\n\t/** Shown under the time field. The caller owns validation. */\n\ttimeErrorMessage?: string;\n\t/** Earliest selectable date, normally now plus whatever lead time applies. */\n\tminDate?: Date;\n\n\t/** The recurrence. Only read when sendMode is RECURRING. */\n\trecurrence?: RecurrenceValue;\n\t/**\n\t * Receives only the fields that changed, so a caller holding this in redux can\n\t * dispatch one action per field instead of replacing the whole object.\n\t */\n\tonRecurrenceChange: (patch: Partial<RecurrenceValue>) => void;\n\n\t/** How many runs the preview lists. */\n\tpreviewCount?: number;\n\t/** Hide the runs preview, for a compact form that shows the summary elsewhere. */\n\thideUpcomingRuns?: boolean;\n\t/** Greys out every control — an in-flight campaign that can no longer be moved. */\n\tdisabled?: boolean;\n\t/** Menu width for the frequency dropdown; defaults to its button's width. */\n\tfrequencyMenuWidth?: string;\n\t/**\n\t * Rendered between the send-mode cards and the fields. For anything a host\n\t * screen wants inline that is not part of the schedule itself — a\n\t * best-time-to-send card, a segment-refresh switch, a warning banner.\n\t */\n\tchildren?: React.ReactNode;\n\t'data-test'?: string;\n}\n\n/**\n * Picks when something sends — once, at a set time, or on a repeating schedule.\n *\n * Controlled and free of any app state: values in, change handlers out. It owns\n * the send-mode cards, the date and time, and — for a repeating schedule — the\n * frequency, what it repeats on, when it ends, and a preview of the next runs.\n *\n * Deliberately domain-neutral. Nothing about campaigns, audiences or sending\n * lives here, so anything that needs a schedule can use it. Host-specific extras\n * go through `children`, which renders below the mode cards.\n *\n * Every part is also exported on its own, for a screen that needs the end picker\n * or the runs preview without the rest.\n */\nexport const ScheduleBuilder: React.FC<ScheduleBuilderProps> = ({\n\tsendMode,\n\tonSendModeChange,\n\tsendModeOptions = DEFAULT_SEND_MODE_OPTIONS,\n\tdate,\n\tonDateChange,\n\tpreviewStartDate,\n\thours,\n\tminutes,\n\tisAm,\n\tonTimeChange,\n\tonMeridiemChange,\n\tonTimeInvalidBlur,\n\ttimeErrorMessage,\n\tminDate,\n\trecurrence,\n\tonRecurrenceChange,\n\tpreviewCount = UPCOMING_RUNS_PREVIEW_COUNT,\n\thideUpcomingRuns = false,\n\tdisabled = false,\n\tfrequencyMenuWidth,\n\tchildren,\n\t'data-test': dataTest = 'schedule-builder',\n}) => {\n\tconst isRecurring = sendMode === SEND_MODE.RECURRING;\n\t// Send-now has no date to pick; the other modes do.\n\tconst showFields = !!sendMode && sendMode !== SEND_MODE.SEND_NOW;\n\n\tconst helper = useMemo(() => new ScheduleHelper(recurrence), [recurrence]);\n\n\t/**\n\t * Runs are previewed from the chosen date — or from `previewStartDate` when the\n\t * host validates separately — so the list stays empty rather than counting from\n\t * today and then jumping once a real date lands.\n\t */\n\tconst previewFrom = previewStartDate === undefined ? date : previewStartDate;\n\n\tconst upcomingRuns = useMemo(\n\t\t() =>\n\t\t\tisRecurring ? helper.computeUpcomingRuns(previewFrom, previewCount) : [],\n\t\t[helper, previewFrom, previewCount, isRecurring],\n\t);\n\n\tconst summary = useMemo(\n\t\t() => helper.buildSummary(upcomingRuns),\n\t\t[helper, upcomingRuns],\n\t);\n\n\treturn (\n\t\t<Column gap={16} data-test={dataTest}>\n\t\t\t<SendModeSelector\n\t\t\t\toptions={sendModeOptions}\n\t\t\t\tvalue={sendMode}\n\t\t\t\tonChange={onSendModeChange}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tdata-test=\"schedule-builder-send-mode\"\n\t\t\t/>\n\t\t\t{children}\n\t\t\t{showFields && (\n\t\t\t\t<>\n\t\t\t\t\t<SectionDivider />\n\t\t\t\t\t<Column gap={12}>\n\t\t\t\t\t\t<StartDateTimePicker\n\t\t\t\t\t\t\tdate={date}\n\t\t\t\t\t\t\tonDateChange={onDateChange}\n\t\t\t\t\t\t\thours={hours}\n\t\t\t\t\t\t\tminutes={minutes}\n\t\t\t\t\t\t\tisAm={isAm}\n\t\t\t\t\t\t\tonTimeChange={onTimeChange}\n\t\t\t\t\t\t\tonMeridiemChange={onMeridiemChange}\n\t\t\t\t\t\t\tonTimeInvalidBlur={onTimeInvalidBlur}\n\t\t\t\t\t\t\ttimeErrorMessage={timeErrorMessage}\n\t\t\t\t\t\t\t// \"Start date\" only reads right when runs follow it.\n\t\t\t\t\t\t\tdateLabel={isRecurring ? 'Start date' : 'Date'}\n\t\t\t\t\t\t\tminDate={minDate}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{isRecurring && (\n\t\t\t\t\t\t\t<Column gap={12} data-test=\"schedule-builder-recurrence\">\n\t\t\t\t\t\t\t\t<ScheduleFrequencyPicker\n\t\t\t\t\t\t\t\t\tvalue={recurrence ?? {}}\n\t\t\t\t\t\t\t\t\tonChange={onRecurrenceChange}\n\t\t\t\t\t\t\t\t\tfrequencyMenuWidth={frequencyMenuWidth}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ScheduleEndPicker\n\t\t\t\t\t\t\t\t\tvalue={recurrence ?? {}}\n\t\t\t\t\t\t\t\t\tonChange={onRecurrenceChange}\n\t\t\t\t\t\t\t\t\tminEndDate={date}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{!hideUpcomingRuns && (\n\t\t\t\t\t\t\t\t\t<UpcomingRunsPreview runs={upcomingRuns} summary={summary} />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Column>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Column>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Column>\n\t);\n};\n"],"names":["DEFAULT_SEND_MODE_OPTIONS","SEND_MODE","ScheduleBuilder","sendMode","onSendModeChange","sendModeOptions","date","onDateChange","previewStartDate","hours","minutes","isAm","onTimeChange","onMeridiemChange","onTimeInvalidBlur","timeErrorMessage","minDate","recurrence","onRecurrenceChange","previewCount","UPCOMING_RUNS_PREVIEW_COUNT","hideUpcomingRuns","disabled","frequencyMenuWidth","children","dataTest","isRecurring","showFields","helper","useMemo","ScheduleHelper","previewFrom","upcomingRuns","summary","jsxs","Column","jsx","SendModeSelector","Fragment","SectionDivider","StartDateTimePicker","ScheduleFrequencyPicker","ScheduleEndPicker","UpcomingRunsPreview"],"mappings":";;;;;;;;;;AAWA,MAAMA,IAAuD;AAAA,EAC5D,EAAE,OAAOC,EAAU,UAAU,OAAO,WAAA;AAAA,EACpC,EAAE,OAAOA,EAAU,UAAU,OAAO,WAAA;AAAA,EACpC,EAAE,OAAOA,EAAU,WAAW,OAAO,mBAAA;AACtC,GA+EaC,IAAkD,CAAC;AAAA,EAC/D,UAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,iBAAAC,IAAkBL;AAAA,EAClB,MAAAM;AAAA,EACA,cAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,cAAAC,IAAeC;AAAA,EACf,kBAAAC,IAAmB;AAAA,EACnB,UAAAC,IAAW;AAAA,EACX,oBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAaC,IAAW;AACzB,MAAM;AACL,QAAMC,IAAcvB,MAAaF,EAAU,WAErC0B,IAAa,CAAC,CAACxB,KAAYA,MAAaF,E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