@bikdotai/bik-component-library 0.0.868-beta.6 → 0.0.868-beta.9

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 (218) hide show
  1. package/README.md +3 -0
  2. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  3. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  4. package/dist/cjs/components/button/themes.js +2 -2
  5. package/dist/cjs/components/button/themes.js.map +1 -1
  6. package/dist/cjs/components/chip-selector/ChipSelector.js +2 -0
  7. package/dist/cjs/components/chip-selector/ChipSelector.js.map +1 -0
  8. package/dist/cjs/components/chip-selector/ChipSelector.styled.js +36 -0
  9. package/dist/cjs/components/chip-selector/ChipSelector.styled.js.map +1 -0
  10. package/dist/cjs/components/chip-selector/ChipSelectorGroup.js +2 -0
  11. package/dist/cjs/components/chip-selector/ChipSelectorGroup.js.map +1 -0
  12. package/dist/cjs/components/combo-box/ComboBox.js +2 -0
  13. package/dist/cjs/components/combo-box/ComboBox.js.map +1 -0
  14. package/dist/cjs/components/combo-box/ComboBox.styled.js +33 -0
  15. package/dist/cjs/components/combo-box/ComboBox.styled.js.map +1 -0
  16. package/dist/cjs/components/datePicker/DatePickerWrapper.js +1 -1
  17. package/dist/cjs/components/datePicker/DatePickerWrapper.js.map +1 -1
  18. package/dist/cjs/components/schedule-builder/RefreshSegmentToggle.js +2 -0
  19. package/dist/cjs/components/schedule-builder/RefreshSegmentToggle.js.map +1 -0
  20. package/dist/cjs/components/schedule-builder/ScheduleBuilder.js +2 -0
  21. package/dist/cjs/components/schedule-builder/ScheduleBuilder.js.map +1 -0
  22. package/dist/cjs/components/schedule-builder/ScheduleBuilder.styled.js +138 -0
  23. package/dist/cjs/components/schedule-builder/ScheduleBuilder.styled.js.map +1 -0
  24. package/dist/cjs/components/schedule-builder/ScheduleEndPicker.js +2 -0
  25. package/dist/cjs/components/schedule-builder/ScheduleEndPicker.js.map +1 -0
  26. package/dist/cjs/components/schedule-builder/ScheduleFrequencyPicker.js +2 -0
  27. package/dist/cjs/components/schedule-builder/ScheduleFrequencyPicker.js.map +1 -0
  28. package/dist/cjs/components/schedule-builder/ScheduleHelper.js +2 -0
  29. package/dist/cjs/components/schedule-builder/ScheduleHelper.js.map +1 -0
  30. package/dist/cjs/components/schedule-builder/SendModeSelector.js +2 -0
  31. package/dist/cjs/components/schedule-builder/SendModeSelector.js.map +1 -0
  32. package/dist/cjs/components/schedule-builder/StartDateTimePicker.js +2 -0
  33. package/dist/cjs/components/schedule-builder/StartDateTimePicker.js.map +1 -0
  34. package/dist/cjs/components/schedule-builder/UpcomingRunsPreview.js +2 -0
  35. package/dist/cjs/components/schedule-builder/UpcomingRunsPreview.js.map +1 -0
  36. package/dist/cjs/components/schedule-builder/model.js +2 -0
  37. package/dist/cjs/components/schedule-builder/model.js.map +1 -0
  38. package/dist/cjs/index.js +1 -1
  39. package/dist/esm/components/agent-builder/constants/tools.d.ts +0 -1
  40. package/dist/esm/components/agent-builder/constants/tools.js +18 -18
  41. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  42. package/dist/esm/components/button/themes.js +2 -1
  43. package/dist/esm/components/button/themes.js.map +1 -1
  44. package/dist/esm/components/chip-selector/ChipSelector.d.ts +9 -0
  45. package/dist/esm/components/chip-selector/ChipSelector.js +27 -0
  46. package/dist/esm/components/chip-selector/ChipSelector.js.map +1 -0
  47. package/dist/esm/components/chip-selector/ChipSelector.styled.d.ts +10 -0
  48. package/dist/esm/components/chip-selector/ChipSelector.styled.js +48 -0
  49. package/dist/esm/components/chip-selector/ChipSelector.styled.js.map +1 -0
  50. package/dist/esm/components/chip-selector/ChipSelectorGroup.d.ts +10 -0
  51. package/dist/esm/components/chip-selector/ChipSelectorGroup.js +48 -0
  52. package/dist/esm/components/chip-selector/ChipSelectorGroup.js.map +1 -0
  53. package/dist/esm/components/chip-selector/index.d.ts +4 -0
  54. package/dist/esm/components/chip-selector/model.d.ts +106 -0
  55. package/dist/esm/components/combo-box/ComboBox.d.ts +15 -0
  56. package/dist/esm/components/combo-box/ComboBox.js +118 -0
  57. package/dist/esm/components/combo-box/ComboBox.js.map +1 -0
  58. package/dist/esm/components/combo-box/ComboBox.styled.d.ts +12 -0
  59. package/dist/esm/components/combo-box/ComboBox.styled.js +40 -0
  60. package/dist/esm/components/combo-box/ComboBox.styled.js.map +1 -0
  61. package/dist/esm/components/combo-box/index.d.ts +3 -0
  62. package/dist/esm/components/combo-box/model.d.ts +55 -0
  63. package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +7 -0
  64. package/dist/esm/components/datePicker/DatePickerWrapper.js +66 -64
  65. package/dist/esm/components/datePicker/DatePickerWrapper.js.map +1 -1
  66. package/dist/esm/components/datePicker/index.d.ts +1 -0
  67. package/dist/esm/components/schedule-builder/RefreshSegmentToggle.d.ts +22 -0
  68. package/dist/esm/components/schedule-builder/RefreshSegmentToggle.js +31 -0
  69. package/dist/esm/components/schedule-builder/RefreshSegmentToggle.js.map +1 -0
  70. package/dist/esm/components/schedule-builder/ScheduleBuilder.d.ts +88 -0
  71. package/dist/esm/components/schedule-builder/ScheduleBuilder.js +105 -0
  72. package/dist/esm/components/schedule-builder/ScheduleBuilder.js.map +1 -0
  73. package/dist/esm/components/schedule-builder/ScheduleBuilder.styled.d.ts +81 -0
  74. package/dist/esm/components/schedule-builder/ScheduleBuilder.styled.js +168 -0
  75. package/dist/esm/components/schedule-builder/ScheduleBuilder.styled.js.map +1 -0
  76. package/dist/esm/components/schedule-builder/ScheduleEndPicker.d.ts +17 -0
  77. package/dist/esm/components/schedule-builder/ScheduleEndPicker.js +105 -0
  78. package/dist/esm/components/schedule-builder/ScheduleEndPicker.js.map +1 -0
  79. package/dist/esm/components/schedule-builder/ScheduleFrequencyPicker.d.ts +21 -0
  80. package/dist/esm/components/schedule-builder/ScheduleFrequencyPicker.js +136 -0
  81. package/dist/esm/components/schedule-builder/ScheduleFrequencyPicker.js.map +1 -0
  82. package/dist/esm/components/schedule-builder/ScheduleHelper.d.ts +110 -0
  83. package/dist/esm/components/schedule-builder/ScheduleHelper.js +196 -0
  84. package/dist/esm/components/schedule-builder/ScheduleHelper.js.map +1 -0
  85. package/dist/esm/components/schedule-builder/SendModeSelector.d.ts +29 -0
  86. package/dist/esm/components/schedule-builder/SendModeSelector.js +41 -0
  87. package/dist/esm/components/schedule-builder/SendModeSelector.js.map +1 -0
  88. package/dist/esm/components/schedule-builder/StartDateTimePicker.d.ts +51 -0
  89. package/dist/esm/components/schedule-builder/StartDateTimePicker.js +120 -0
  90. package/dist/esm/components/schedule-builder/StartDateTimePicker.js.map +1 -0
  91. package/dist/esm/components/schedule-builder/UpcomingRunsPreview.d.ts +19 -0
  92. package/dist/esm/components/schedule-builder/UpcomingRunsPreview.js +44 -0
  93. package/dist/esm/components/schedule-builder/UpcomingRunsPreview.js.map +1 -0
  94. package/dist/esm/components/schedule-builder/index.d.ts +18 -0
  95. package/dist/esm/components/schedule-builder/model.d.ts +69 -0
  96. package/dist/esm/components/schedule-builder/model.js +8 -0
  97. package/dist/esm/components/schedule-builder/model.js.map +1 -0
  98. package/dist/esm/index.d.ts +3 -1
  99. package/dist/esm/index.js +828 -844
  100. package/dist/esm/index.js.map +1 -1
  101. package/package.json +1 -1
  102. package/dist/cjs/components/bik-copilot/BIKCopilot.js +0 -2
  103. package/dist/cjs/components/bik-copilot/BIKCopilot.js.map +0 -1
  104. package/dist/cjs/components/bik-copilot/ControlledCopilot.js +0 -2
  105. package/dist/cjs/components/bik-copilot/ControlledCopilot.js.map +0 -1
  106. package/dist/cjs/components/bik-copilot/ControlledCopilot.styled.js +0 -27
  107. package/dist/cjs/components/bik-copilot/ControlledCopilot.styled.js.map +0 -1
  108. package/dist/cjs/components/bik-copilot/CopilotBall.js +0 -2
  109. package/dist/cjs/components/bik-copilot/CopilotBall.js.map +0 -1
  110. package/dist/cjs/components/bik-copilot/CopilotBall.styled.js +0 -42
  111. package/dist/cjs/components/bik-copilot/CopilotBall.styled.js.map +0 -1
  112. package/dist/cjs/components/bik-copilot/CopilotFeedbackModal.js +0 -2
  113. package/dist/cjs/components/bik-copilot/CopilotFeedbackModal.js.map +0 -1
  114. package/dist/cjs/components/bik-copilot/CopilotFeedbackModal.styled.js +0 -108
  115. package/dist/cjs/components/bik-copilot/CopilotFeedbackModal.styled.js.map +0 -1
  116. package/dist/cjs/components/bik-copilot/CopilotPanel.js +0 -2
  117. package/dist/cjs/components/bik-copilot/CopilotPanel.js.map +0 -1
  118. package/dist/cjs/components/bik-copilot/CopilotPanel.styled.js +0 -534
  119. package/dist/cjs/components/bik-copilot/CopilotPanel.styled.js.map +0 -1
  120. package/dist/cjs/components/bik-copilot/copilotPlacement.js +0 -2
  121. package/dist/cjs/components/bik-copilot/copilotPlacement.js.map +0 -1
  122. package/dist/cjs/components/bik-copilot/copilotRegenerate.js +0 -2
  123. package/dist/cjs/components/bik-copilot/copilotRegenerate.js.map +0 -1
  124. package/dist/cjs/components/bik-copilot/services/copilotDb.js +0 -2
  125. package/dist/cjs/components/bik-copilot/services/copilotDb.js.map +0 -1
  126. package/dist/cjs/components/bik-copilot/services/copilotFeedbackClient.js +0 -2
  127. package/dist/cjs/components/bik-copilot/services/copilotFeedbackClient.js.map +0 -1
  128. package/dist/cjs/components/bik-copilot/services/copilotIcebreakersClient.js +0 -2
  129. package/dist/cjs/components/bik-copilot/services/copilotIcebreakersClient.js.map +0 -1
  130. package/dist/cjs/components/bik-copilot/services/copilotMessagesClient.js +0 -2
  131. package/dist/cjs/components/bik-copilot/services/copilotMessagesClient.js.map +0 -1
  132. package/dist/cjs/components/bik-copilot/services/copilotPageSession.js +0 -2
  133. package/dist/cjs/components/bik-copilot/services/copilotPageSession.js.map +0 -1
  134. package/dist/cjs/components/bik-copilot/services/copilotSseParser.js +0 -7
  135. package/dist/cjs/components/bik-copilot/services/copilotSseParser.js.map +0 -1
  136. package/dist/cjs/components/bik-copilot/services/copilotStreamClient.js +0 -2
  137. package/dist/cjs/components/bik-copilot/services/copilotStreamClient.js.map +0 -1
  138. package/dist/cjs/components/bik-copilot/useCopilotIcebreakers.js +0 -2
  139. package/dist/cjs/components/bik-copilot/useCopilotIcebreakers.js.map +0 -1
  140. package/dist/cjs/components/bik-copilot/useCopilotStreamChat.js +0 -2
  141. package/dist/cjs/components/bik-copilot/useCopilotStreamChat.js.map +0 -1
  142. package/dist/cjs/components/bik-copilot/useDraggableFloater.js +0 -2
  143. package/dist/cjs/components/bik-copilot/useDraggableFloater.js.map +0 -1
  144. package/dist/cjs/components/bik-copilot/utils/markdown.js +0 -4
  145. package/dist/cjs/components/bik-copilot/utils/markdown.js.map +0 -1
  146. package/dist/cjs/components/bik-copilot/utils/toolCtas.js +0 -2
  147. package/dist/cjs/components/bik-copilot/utils/toolCtas.js.map +0 -1
  148. package/dist/esm/components/bik-copilot/BIKCopilot.d.ts +0 -31
  149. package/dist/esm/components/bik-copilot/BIKCopilot.js +0 -118
  150. package/dist/esm/components/bik-copilot/BIKCopilot.js.map +0 -1
  151. package/dist/esm/components/bik-copilot/ControlledCopilot.d.ts +0 -14
  152. package/dist/esm/components/bik-copilot/ControlledCopilot.js +0 -174
  153. package/dist/esm/components/bik-copilot/ControlledCopilot.js.map +0 -1
  154. package/dist/esm/components/bik-copilot/ControlledCopilot.styled.d.ts +0 -7
  155. package/dist/esm/components/bik-copilot/ControlledCopilot.styled.js +0 -31
  156. package/dist/esm/components/bik-copilot/ControlledCopilot.styled.js.map +0 -1
  157. package/dist/esm/components/bik-copilot/CopilotBall.d.ts +0 -13
  158. package/dist/esm/components/bik-copilot/CopilotBall.js +0 -50
  159. package/dist/esm/components/bik-copilot/CopilotBall.js.map +0 -1
  160. package/dist/esm/components/bik-copilot/CopilotBall.styled.d.ts +0 -9
  161. package/dist/esm/components/bik-copilot/CopilotBall.styled.js +0 -46
  162. package/dist/esm/components/bik-copilot/CopilotBall.styled.js.map +0 -1
  163. package/dist/esm/components/bik-copilot/CopilotFeedbackModal.d.ts +0 -29
  164. package/dist/esm/components/bik-copilot/CopilotFeedbackModal.js +0 -73
  165. package/dist/esm/components/bik-copilot/CopilotFeedbackModal.js.map +0 -1
  166. package/dist/esm/components/bik-copilot/CopilotFeedbackModal.styled.d.ts +0 -12
  167. package/dist/esm/components/bik-copilot/CopilotFeedbackModal.styled.js +0 -122
  168. package/dist/esm/components/bik-copilot/CopilotFeedbackModal.styled.js.map +0 -1
  169. package/dist/esm/components/bik-copilot/CopilotPanel.d.ts +0 -9
  170. package/dist/esm/components/bik-copilot/CopilotPanel.js +0 -536
  171. package/dist/esm/components/bik-copilot/CopilotPanel.js.map +0 -1
  172. package/dist/esm/components/bik-copilot/CopilotPanel.styled.d.ts +0 -67
  173. package/dist/esm/components/bik-copilot/CopilotPanel.styled.js +0 -573
  174. package/dist/esm/components/bik-copilot/CopilotPanel.styled.js.map +0 -1
  175. package/dist/esm/components/bik-copilot/copilotPlacement.d.ts +0 -24
  176. package/dist/esm/components/bik-copilot/copilotPlacement.js +0 -38
  177. package/dist/esm/components/bik-copilot/copilotPlacement.js.map +0 -1
  178. package/dist/esm/components/bik-copilot/copilotRegenerate.d.ts +0 -22
  179. package/dist/esm/components/bik-copilot/copilotRegenerate.js +0 -6
  180. package/dist/esm/components/bik-copilot/copilotRegenerate.js.map +0 -1
  181. package/dist/esm/components/bik-copilot/index.d.ts +0 -19
  182. package/dist/esm/components/bik-copilot/model.d.ts +0 -804
  183. package/dist/esm/components/bik-copilot/services/copilotDb.d.ts +0 -90
  184. package/dist/esm/components/bik-copilot/services/copilotDb.js +0 -96
  185. package/dist/esm/components/bik-copilot/services/copilotDb.js.map +0 -1
  186. package/dist/esm/components/bik-copilot/services/copilotFeedbackClient.d.ts +0 -15
  187. package/dist/esm/components/bik-copilot/services/copilotFeedbackClient.js +0 -55
  188. package/dist/esm/components/bik-copilot/services/copilotFeedbackClient.js.map +0 -1
  189. package/dist/esm/components/bik-copilot/services/copilotIcebreakersClient.d.ts +0 -11
  190. package/dist/esm/components/bik-copilot/services/copilotIcebreakersClient.js +0 -54
  191. package/dist/esm/components/bik-copilot/services/copilotIcebreakersClient.js.map +0 -1
  192. package/dist/esm/components/bik-copilot/services/copilotMessagesClient.d.ts +0 -23
  193. package/dist/esm/components/bik-copilot/services/copilotMessagesClient.js +0 -78
  194. package/dist/esm/components/bik-copilot/services/copilotMessagesClient.js.map +0 -1
  195. package/dist/esm/components/bik-copilot/services/copilotPageSession.d.ts +0 -37
  196. package/dist/esm/components/bik-copilot/services/copilotPageSession.js +0 -35
  197. package/dist/esm/components/bik-copilot/services/copilotPageSession.js.map +0 -1
  198. package/dist/esm/components/bik-copilot/services/copilotSseParser.d.ts +0 -22
  199. package/dist/esm/components/bik-copilot/services/copilotSseParser.js +0 -52
  200. package/dist/esm/components/bik-copilot/services/copilotSseParser.js.map +0 -1
  201. package/dist/esm/components/bik-copilot/services/copilotStreamClient.d.ts +0 -35
  202. package/dist/esm/components/bik-copilot/services/copilotStreamClient.js +0 -110
  203. package/dist/esm/components/bik-copilot/services/copilotStreamClient.js.map +0 -1
  204. package/dist/esm/components/bik-copilot/useCopilotIcebreakers.d.ts +0 -17
  205. package/dist/esm/components/bik-copilot/useCopilotIcebreakers.js +0 -60
  206. package/dist/esm/components/bik-copilot/useCopilotIcebreakers.js.map +0 -1
  207. package/dist/esm/components/bik-copilot/useCopilotStreamChat.d.ts +0 -20
  208. package/dist/esm/components/bik-copilot/useCopilotStreamChat.js +0 -377
  209. package/dist/esm/components/bik-copilot/useCopilotStreamChat.js.map +0 -1
  210. package/dist/esm/components/bik-copilot/useDraggableFloater.d.ts +0 -9
  211. package/dist/esm/components/bik-copilot/useDraggableFloater.js +0 -118
  212. package/dist/esm/components/bik-copilot/useDraggableFloater.js.map +0 -1
  213. package/dist/esm/components/bik-copilot/utils/markdown.d.ts +0 -1
  214. package/dist/esm/components/bik-copilot/utils/markdown.js +0 -48
  215. package/dist/esm/components/bik-copilot/utils/markdown.js.map +0 -1
  216. package/dist/esm/components/bik-copilot/utils/toolCtas.d.ts +0 -6
  217. package/dist/esm/components/bik-copilot/utils/toolCtas.js +0 -27
  218. package/dist/esm/components/bik-copilot/utils/toolCtas.js.map +0 -1
@@ -0,0 +1,168 @@
1
+ import i from "styled-components";
2
+ import { COLORS as t } from "../../constants/Theme.js";
3
+ const o = 84, n = 8, d = i.div`
4
+ display: flex;
5
+ flex-direction: column;
6
+ min-width: 0;
7
+ gap: 6px;
8
+ `, l = i(d)`
9
+ flex: 1 1 0;
10
+ `, a = i(d)`
11
+ flex: 1 1 ${o + n}px;
12
+ `, s = i.div`
13
+ display: flex;
14
+ flex-direction: row;
15
+ gap: 16px;
16
+ width: 100%;
17
+ align-items: flex-start;
18
+ `, x = i.div`
19
+ height: 48px;
20
+ `, c = i.div`
21
+ display: flex;
22
+ flex-direction: row;
23
+ gap: ${n}px;
24
+ align-items: flex-start;
25
+ `, g = i.div`
26
+ flex: 1;
27
+ min-width: 0;
28
+ `, f = i.div`
29
+ flex: 0 0 ${o}px;
30
+ `, h = i.div`
31
+ width: 100%;
32
+ min-width: 0;
33
+ `, m = i.div`
34
+ display: flex;
35
+ flex-direction: column;
36
+ gap: 8px;
37
+ width: 337px;
38
+ max-width: 100%;
39
+ `, w = i.div`
40
+ display: flex;
41
+ flex-direction: row;
42
+ align-items: flex-start;
43
+ gap: 4px;
44
+
45
+ svg {
46
+ flex: 0 0 16px;
47
+ width: 16px;
48
+ height: 16px;
49
+ }
50
+ `, u = i.div`
51
+ display: flex;
52
+ align-items: center;
53
+ gap: 2px;
54
+ `, v = i.span`
55
+ font-weight: 600;
56
+ `, y = i.span`
57
+ color: ${t.content.negative};
58
+ `, b = i.div`
59
+ box-sizing: border-box;
60
+ display: flex;
61
+ flex-direction: row;
62
+ align-items: center;
63
+ gap: 4px;
64
+ padding: 16px;
65
+ flex: 1;
66
+ height: 56px;
67
+ border-radius: 4px;
68
+ border: 1px solid
69
+ ${(e) => e.active ? t.background.inverseLight : t.stroke.primary};
70
+ background: ${(e) => e.active ? t.background.brandLight : t.surface.standard};
71
+ cursor: ${(e) => e.disabled ? "not-allowed" : "pointer"};
72
+ opacity: ${(e) => e.disabled ? 0.6 : 1};
73
+ `, R = i.div`
74
+ display: flex;
75
+ flex-direction: row;
76
+ gap: 16px;
77
+ width: 100%;
78
+ `, k = i.div`
79
+ height: 1px;
80
+ width: 100%;
81
+ background: ${t.stroke.primary};
82
+ `, $ = i.div`
83
+ display: flex;
84
+ flex-direction: row;
85
+ align-items: center;
86
+ gap: 12px;
87
+ flex-wrap: wrap;
88
+ `, S = i.div`
89
+ width: 44px;
90
+ `, D = i.div`
91
+ width: 168px;
92
+ `, C = i.div`
93
+ position: relative;
94
+ display: flex;
95
+ flex-direction: row;
96
+ align-items: center;
97
+ gap: 8px;
98
+
99
+ /* connector spanning the 16px gap to the next run */
100
+ ::before {
101
+ content: '';
102
+ position: absolute;
103
+ left: 4.5px;
104
+ top: 100%;
105
+ height: 16px;
106
+ width: 1px;
107
+ background: ${(e) => e.isLast ? "transparent" : t.stroke.brandLightAlt};
108
+ }
109
+ `, I = i.div`
110
+ width: 10px;
111
+ height: 10px;
112
+ border-radius: 50%;
113
+ background: ${t.background.inverseLight};
114
+ flex-shrink: 0;
115
+ z-index: 1;
116
+ `, L = i.div`
117
+ display: flex;
118
+ flex-direction: row;
119
+ align-items: center;
120
+ gap: 12px;
121
+ width: 100%;
122
+ justify-content: space-between;
123
+ padding-top: 16px;
124
+ border-top: 1px solid ${t.stroke.primary};
125
+ `, M = i.div`
126
+ display: flex;
127
+ flex-direction: column;
128
+ gap: 4px;
129
+ `, F = i.div`
130
+ display: flex;
131
+ flex-direction: column;
132
+ gap: ${(e) => e.gap ?? 12}px;
133
+ width: 100%;
134
+ `, T = i.div`
135
+ display: flex;
136
+ flex-direction: row;
137
+ align-items: center;
138
+ gap: ${(e) => e.gap ?? 8}px;
139
+ `;
140
+ export {
141
+ w as CaptionWithIcon,
142
+ F as Column,
143
+ l as DateFieldColumn,
144
+ x as DatePickerSlot,
145
+ D as EndDateWrapper,
146
+ $ as EndsRow,
147
+ d as FieldColumn,
148
+ u as FieldLabel,
149
+ s as FieldsRow,
150
+ h as FrequencyDropdownSlot,
151
+ f as MeridiemDropdownSlot,
152
+ m as MonthDateGridSlot,
153
+ M as RefreshSegmentCopy,
154
+ L as RefreshSegmentRow,
155
+ y as RequiredMark,
156
+ T as Row,
157
+ S as RunCountInputWrapper,
158
+ k as SectionDivider,
159
+ b as SendModeOption,
160
+ R as SendModeRow,
161
+ v as SummaryHighlight,
162
+ g as TimeDropdownSlot,
163
+ a as TimeFieldColumn,
164
+ c as TimeInputRow,
165
+ I as UpcomingRunDot,
166
+ C as UpcomingRunItem
167
+ };
168
+ //# sourceMappingURL=ScheduleBuilder.styled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScheduleBuilder.styled.js","sources":["../../../../src/components/schedule-builder/ScheduleBuilder.styled.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { COLORS } from '../../constants/Theme';\n\n/** Fixed width of the am/pm dropdown, and the gap separating it from the time box. */\nconst MERIDIEM_SLOT_WIDTH = 84;\nconst TIME_ROW_GAP = 8;\n\n/**\n * A labelled field column — \"Start date\" and \"Time\" sit side by side.\n * 6px label-to-input gap comes from the design's `input-large` component.\n */\nexport const FieldColumn = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-width: 0;\n\tgap: 6px;\n`;\n\nexport const DateFieldColumn = styled(FieldColumn)`\n\tflex: 1 1 0;\n`;\n\n/**\n * Same share as the date column plus the am/pm dropdown's footprint (84px\n * wide + 8px gap), so the time box itself matches the date box rather than\n * being squeezed by the dropdown sitting beside it.\n */\nexport const TimeFieldColumn = styled(FieldColumn)`\n\tflex: 1 1 ${MERIDIEM_SLOT_WIDTH + TIME_ROW_GAP}px;\n`;\n\n/**\n * The Start date / Time row.\n *\n * Aligned to the top rather than centred: the time field grows taller when its\n * validation message appears, and a centred row would shift the date field up\n * and down with it.\n */\nexport const FieldsRow = styled.div`\n\tdisplay: flex;\n\tflex-direction: row;\n\tgap: 16px;\n\twidth: 100%;\n\talign-items: flex-start;\n`;\n\n/** Wraps the date picker so its button matches the 48px input height. */\nexport const DatePickerSlot = styled.div`\n\theight: 48px;\n`;\n\n/**\n * The time box and its am/pm dropdown.\n *\n * Top-aligned rather than centred: the validation message renders inside the\n * time slot, so a centred row would push am/pm downward as the message appears.\n */\nexport const TimeInputRow = styled.div`\n\tdisplay: flex;\n\tflex-direction: row;\n\tgap: ${TIME_ROW_GAP}px;\n\talign-items: flex-start;\n`;\n\n/** The hh:mm dropdown takes the free space; am/pm is fixed beside it. */\nexport const TimeDropdownSlot = styled.div`\n\tflex: 1;\n\tmin-width: 0;\n`;\n\nexport const MeridiemDropdownSlot = styled.div`\n\tflex: 0 0 ${MERIDIEM_SLOT_WIDTH}px;\n`;\n\n/**\n * Frequency field. Fills its column, which is a DateFieldColumn so it takes the\n * same share as Start date above it — the design has both as 337px halves of the\n * 690px row, rather than a fixed 220px box that drifts as the panel resizes.\n */\nexport const FrequencyDropdownSlot = styled.div`\n\twidth: 100%;\n\tmin-width: 0;\n`;\n\n/**\n * Monthly date grid. Fixed at 337px so six CHIP_WIDTH chips and their 8px gaps\n * wrap onto a tidy 6-per-row grid rather than reflowing with the panel width.\n */\nexport const MonthDateGridSlot = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\twidth: 337px;\n\tmax-width: 100%;\n`;\n\n/**\n * Icon + text caption under a picker, for both validation errors and the\n * skipped-month note. The icon is pinned to its 16px box and aligned to the\n * first line — as a bare flex child it would stretch and open a wide gap.\n */\nexport const CaptionWithIcon = styled.div`\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: flex-start;\n\tgap: 4px;\n\n\tsvg {\n\t\tflex: 0 0 16px;\n\t\twidth: 16px;\n\t\theight: 16px;\n\t}\n`;\n\n/** Field label row — holds the caption and its required asterisk. */\nexport const FieldLabel = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 2px;\n`;\n\n/** Frequency and time read in semibold inside the summary line. */\nexport const SummaryHighlight = styled.span`\n\tfont-weight: 600;\n`;\n\nexport const RequiredMark = styled.span`\n\tcolor: ${COLORS.content.negative};\n`;\n\n/** A single selectable send-mode card. */\nexport const SendModeOption = styled.div<{\n\tactive: boolean;\n\tdisabled: boolean;\n}>`\n\tbox-sizing: border-box;\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: center;\n\tgap: 4px;\n\tpadding: 16px;\n\tflex: 1;\n\theight: 56px;\n\tborder-radius: 4px;\n\tborder: 1px solid\n\t\t${(props) =>\n\t\t\tprops.active ? COLORS.background.inverseLight : COLORS.stroke.primary};\n\tbackground: ${(props) =>\n\t\tprops.active ? COLORS.background.brandLight : COLORS.surface.standard};\n\tcursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n\topacity: ${(props) => (props.disabled ? 0.6 : 1)};\n`;\n\n/** The row of send-mode cards. */\nexport const SendModeRow = styled.div`\n\tdisplay: flex;\n\tflex-direction: row;\n\tgap: 16px;\n\twidth: 100%;\n`;\n\n/** 1px rule between the send-mode radios and the fields below. */\nexport const SectionDivider = styled.div`\n\theight: 1px;\n\twidth: 100%;\n\tbackground: ${COLORS.stroke.primary};\n`;\n\n/** \"Ends\" row wraps when the three options do not fit on one line. */\nexport const EndsRow = styled.div`\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: center;\n\tgap: 12px;\n\tflex-wrap: wrap;\n`;\n\n/** 44px wide, 32px tall — the design's small input. */\nexport const RunCountInputWrapper = styled.div`\n\twidth: 44px;\n`;\n\nexport const EndDateWrapper = styled.div`\n\twidth: 168px;\n`;\n\nexport const UpcomingRunItem = styled.div<{ isLast: boolean }>`\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: center;\n\tgap: 8px;\n\n\t/* connector spanning the 16px gap to the next run */\n\t::before {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\tleft: 4.5px;\n\t\ttop: 100%;\n\t\theight: 16px;\n\t\twidth: 1px;\n\t\tbackground: ${(props) =>\n\t\t\tprops.isLast ? 'transparent' : COLORS.stroke.brandLightAlt};\n\t}\n`;\n\nexport const UpcomingRunDot = styled.div`\n\twidth: 10px;\n\theight: 10px;\n\tborder-radius: 50%;\n\tbackground: ${COLORS.background.inverseLight};\n\tflex-shrink: 0;\n\tz-index: 1;\n`;\n\nexport const RefreshSegmentRow = styled.div`\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: center;\n\tgap: 12px;\n\twidth: 100%;\n\tjustify-content: space-between;\n\tpadding-top: 16px;\n\tborder-top: 1px solid ${COLORS.stroke.primary};\n`;\n\nexport const RefreshSegmentCopy = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n`;\n\n/** Generic vertical stack — the library cannot rely on the app's utility classes. */\nexport const Column = styled.div<{ gap?: number }>`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: ${(props) => props.gap ?? 12}px;\n\twidth: 100%;\n`;\n\nexport const Row = styled.div<{ gap?: number }>`\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: center;\n\tgap: ${(props) => props.gap ?? 8}px;\n`;\n"],"names":["MERIDIEM_SLOT_WIDTH","TIME_ROW_GAP","FieldColumn","styled","DateFieldColumn","TimeFieldColumn","FieldsRow","DatePickerSlot","TimeInputRow","TimeDropdownSlot","MeridiemDropdownSlot","FrequencyDropdownSlot","MonthDateGridSlot","CaptionWithIcon","FieldLabel","SummaryHighlight","RequiredMark","COLORS","SendModeOption","props","SendModeRow","SectionDivider","EndsRow","RunCountInputWrapper","EndDateWrapper","UpcomingRunItem","UpcomingRunDot","RefreshSegmentRow","RefreshSegmentCopy","Column","Row"],"mappings":";;AAIA,MAAMA,IAAsB,IACtBC,IAAe,GAMRC,IAAcC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOrBC,IAAkBD,EAAOD,CAAW;AAAA;AAAA,GASpCG,IAAkBF,EAAOD,CAAW;AAAA,aACpCF,IAA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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAetB,CAACgB,MACdA,EAAM,SAAS,gBAAgBF,EAAO,OAAO,aAAa;AAAA;AAAA,GAIhDS,IAAiBvB,EAAO;AAAA;AAAA;AAAA;AAAA,eAItBc,EAAO,WAAW,YAAY;AAAA;AAAA;AAAA,GAKhCU,IAAoBxB,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAQfc,EAAO,OAAO,OAAO;AAAA,GAGjCW,IAAqBzB,EAAO;AAAA;AAAA;AAAA;AAAA,GAO5B0B,IAAS1B,EAAO;AAAA;AAAA;AAAA,QAGrB,CAACgB,MAAUA,EAAM,OAAO,EAAE;AAAA;AAAA,GAIrBW,IAAM3B,EAAO;AAAA;AAAA;AAAA;AAAA,QAIlB,CAACgB,MAAUA,EAAM,OAAO,CAAC;AAAA;"}
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ import { RecurrenceValue } from './model';
3
+ export interface ScheduleEndPickerProps {
4
+ value: RecurrenceValue;
5
+ onChange: (patch: Partial<RecurrenceValue>) => void;
6
+ /** Earliest selectable end date — normally the series' own start date. */
7
+ minEndDate?: Date;
8
+ 'data-test'?: string;
9
+ }
10
+ /**
11
+ * "Never / After N runs / On <date>".
12
+ *
13
+ * The run-count input and the end-date picker stay mounted and go disabled with
14
+ * their mode rather than unmounting, so the row keeps its width and the controls
15
+ * do not jump as the merchant switches between them.
16
+ */
17
+ export declare const ScheduleEndPicker: React.FC<ScheduleEndPickerProps>;
@@ -0,0 +1,105 @@
1
+ import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
+ import { COLORS as s } from "../../constants/Theme.js";
3
+ import { BodySecondary as R } from "../TypographyStyle.js";
4
+ import { RECURRENCE_END_MODE as e } from "./model.js";
5
+ import { FieldColumn as u, FieldLabel as N, EndsRow as O, Row as p, RunCountInputWrapper as D, EndDateWrapper as _ } from "./ScheduleBuilder.styled.js";
6
+ import { MAX_RECURRENCE_RUNS as m } from "./ScheduleHelper.js";
7
+ import { RadioButton as l } from "../radioButton/RadioButton.js";
8
+ import { Input as S } from "../input/Input.js";
9
+ import { DatePickerWrapper as h } from "../datePicker/DatePickerWrapper.js";
10
+ const c = s.background.inverseLight, F = ({
11
+ value: o,
12
+ onChange: t,
13
+ minEndDate: f,
14
+ "data-test": A
15
+ }) => {
16
+ const n = o?.endMode ?? e.NEVER;
17
+ return /* @__PURE__ */ a(u, { "data-test": A, children: [
18
+ /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(R, { color: s.content.primary, children: "Ends" }) }),
19
+ /* @__PURE__ */ a(O, { children: [
20
+ /* @__PURE__ */ r(
21
+ l,
22
+ {
23
+ isActive: n === e.NEVER,
24
+ label: "Never",
25
+ value: e.NEVER,
26
+ onValueChange: () => t({ endMode: e.NEVER }),
27
+ activeColor: c,
28
+ skipSelectingOff: n === e.NEVER
29
+ }
30
+ ),
31
+ /* @__PURE__ */ a(p, { gap: 8, children: [
32
+ /* @__PURE__ */ r(
33
+ l,
34
+ {
35
+ isActive: n === e.AFTER_RUNS,
36
+ label: "After",
37
+ value: e.AFTER_RUNS,
38
+ onValueChange: () => t({ endMode: e.AFTER_RUNS }),
39
+ activeColor: c,
40
+ skipSelectingOff: n === e.AFTER_RUNS
41
+ }
42
+ ),
43
+ /* @__PURE__ */ r(D, { children: /* @__PURE__ */ r(
44
+ S,
45
+ {
46
+ variant: "small",
47
+ type: "number",
48
+ placeholder: String(m),
49
+ value: o?.endAfterRuns ? String(o.endAfterRuns) : "",
50
+ state: n === e.AFTER_RUNS ? "none" : "disabled",
51
+ onChangeText: (i) => {
52
+ const d = i.replace(/\D/g, "");
53
+ if (!d) {
54
+ t({ endAfterRuns: void 0 });
55
+ return;
56
+ }
57
+ t({
58
+ endAfterRuns: Math.min(
59
+ Number(d),
60
+ m
61
+ )
62
+ });
63
+ }
64
+ }
65
+ ) }),
66
+ /* @__PURE__ */ r(R, { color: s.content.primary, children: "runs" })
67
+ ] }),
68
+ /* @__PURE__ */ a(p, { gap: 8, children: [
69
+ /* @__PURE__ */ r(
70
+ l,
71
+ {
72
+ isActive: n === e.ON_DATE,
73
+ label: "On",
74
+ value: e.ON_DATE,
75
+ onValueChange: () => t({ endMode: e.ON_DATE }),
76
+ activeColor: c,
77
+ skipSelectingOff: n === e.ON_DATE
78
+ }
79
+ ),
80
+ /* @__PURE__ */ r(_, { children: /* @__PURE__ */ r(
81
+ h,
82
+ {
83
+ val: o?.endOnDate ? new Date(o.endOnDate * 1e3) : void 0,
84
+ disabled: n !== e.ON_DATE,
85
+ onChange: (i) => {
86
+ const d = Array.isArray(i) ? i[0] : i;
87
+ if (!d) return;
88
+ const E = new Date(d);
89
+ E.setHours(23, 59, 59, 0), t({
90
+ endMode: e.ON_DATE,
91
+ endOnDate: Math.floor(E.getTime() / 1e3)
92
+ });
93
+ },
94
+ calendarProps: { minDate: f },
95
+ pickerStyles: { top: 8, zIndex: 4 }
96
+ }
97
+ ) })
98
+ ] })
99
+ ] })
100
+ ] });
101
+ };
102
+ export {
103
+ F as ScheduleEndPicker
104
+ };
105
+ //# sourceMappingURL=ScheduleEndPicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScheduleEndPicker.js","sources":["../../../../src/components/schedule-builder/ScheduleEndPicker.tsx"],"sourcesContent":["import React from 'react';\nimport { COLORS } from '../../constants/Theme';\nimport { DatePickerWrapper } from '../datePicker';\nimport { Input } from '../input';\nimport { RadioButton } from '../radioButton';\nimport { BodySecondary } from '../TypographyStyle';\nimport { RECURRENCE_END_MODE, RecurrenceValue } from './model';\nimport {\n\tEndDateWrapper,\n\tEndsRow,\n\tFieldColumn,\n\tFieldLabel,\n\tRow,\n\tRunCountInputWrapper,\n} from './ScheduleBuilder.styled';\nimport { MAX_RECURRENCE_RUNS } from './ScheduleHelper';\n\n/**\n * Radios in this section read brand purple when selected. The library defaults\n * to the positive green, which is not what the design shows.\n */\nconst RADIO_ACTIVE_COLOR = COLORS.background.inverseLight;\n\nexport interface ScheduleEndPickerProps {\n\tvalue: RecurrenceValue;\n\tonChange: (patch: Partial<RecurrenceValue>) => void;\n\t/** Earliest selectable end date — normally the series' own start date. */\n\tminEndDate?: Date;\n\t'data-test'?: string;\n}\n\n/**\n * \"Never / After N runs / On <date>\".\n *\n * The run-count input and the end-date picker stay mounted and go disabled with\n * their mode rather than unmounting, so the row keeps its width and the controls\n * do not jump as the merchant switches between them.\n */\nexport const ScheduleEndPicker: React.FC<ScheduleEndPickerProps> = ({\n\tvalue,\n\tonChange,\n\tminEndDate,\n\t'data-test': dataTest,\n}) => {\n\tconst endMode = value?.endMode ?? RECURRENCE_END_MODE.NEVER;\n\n\treturn (\n\t\t<FieldColumn data-test={dataTest}>\n\t\t\t<FieldLabel>\n\t\t\t\t<BodySecondary color={COLORS.content.primary}>Ends</BodySecondary>\n\t\t\t</FieldLabel>\n\t\t\t<EndsRow>\n\t\t\t\t<RadioButton\n\t\t\t\t\tisActive={endMode === RECURRENCE_END_MODE.NEVER}\n\t\t\t\t\tlabel=\"Never\"\n\t\t\t\t\tvalue={RECURRENCE_END_MODE.NEVER}\n\t\t\t\t\tonValueChange={() => onChange({ endMode: RECURRENCE_END_MODE.NEVER })}\n\t\t\t\t\tactiveColor={RADIO_ACTIVE_COLOR}\n\t\t\t\t\t// Inert only once selected — an end mode is always required, so the\n\t\t\t\t\t// active option cannot be clicked off.\n\t\t\t\t\tskipSelectingOff={endMode === RECURRENCE_END_MODE.NEVER}\n\t\t\t\t/>\n\n\t\t\t\t<Row gap={8}>\n\t\t\t\t\t<RadioButton\n\t\t\t\t\t\tisActive={endMode === RECURRENCE_END_MODE.AFTER_RUNS}\n\t\t\t\t\t\tlabel=\"After\"\n\t\t\t\t\t\tvalue={RECURRENCE_END_MODE.AFTER_RUNS}\n\t\t\t\t\t\tonValueChange={() =>\n\t\t\t\t\t\t\tonChange({ endMode: RECURRENCE_END_MODE.AFTER_RUNS })\n\t\t\t\t\t\t}\n\t\t\t\t\t\tactiveColor={RADIO_ACTIVE_COLOR}\n\t\t\t\t\t\tskipSelectingOff={endMode === RECURRENCE_END_MODE.AFTER_RUNS}\n\t\t\t\t\t/>\n\t\t\t\t\t<RunCountInputWrapper>\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\tvariant=\"small\"\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tplaceholder={String(MAX_RECURRENCE_RUNS)}\n\t\t\t\t\t\t\tvalue={value?.endAfterRuns ? String(value.endAfterRuns) : ''}\n\t\t\t\t\t\t\tstate={\n\t\t\t\t\t\t\t\tendMode === RECURRENCE_END_MODE.AFTER_RUNS ? 'none' : 'disabled'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonChangeText={(input: string) => {\n\t\t\t\t\t\t\t\tconst digitsOnly = input.replace(/\\D/g, '');\n\t\t\t\t\t\t\t\tif (!digitsOnly) {\n\t\t\t\t\t\t\t\t\tonChange({ endAfterRuns: undefined });\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange({\n\t\t\t\t\t\t\t\t\tendAfterRuns: Math.min(\n\t\t\t\t\t\t\t\t\t\tNumber(digitsOnly),\n\t\t\t\t\t\t\t\t\t\tMAX_RECURRENCE_RUNS,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</RunCountInputWrapper>\n\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>runs</BodySecondary>\n\t\t\t\t</Row>\n\n\t\t\t\t<Row gap={8}>\n\t\t\t\t\t<RadioButton\n\t\t\t\t\t\tisActive={endMode === RECURRENCE_END_MODE.ON_DATE}\n\t\t\t\t\t\tlabel=\"On\"\n\t\t\t\t\t\tvalue={RECURRENCE_END_MODE.ON_DATE}\n\t\t\t\t\t\tonValueChange={() =>\n\t\t\t\t\t\t\tonChange({ endMode: RECURRENCE_END_MODE.ON_DATE })\n\t\t\t\t\t\t}\n\t\t\t\t\t\tactiveColor={RADIO_ACTIVE_COLOR}\n\t\t\t\t\t\tskipSelectingOff={endMode === RECURRENCE_END_MODE.ON_DATE}\n\t\t\t\t\t/>\n\t\t\t\t\t<EndDateWrapper>\n\t\t\t\t\t\t<DatePickerWrapper\n\t\t\t\t\t\t\tval={\n\t\t\t\t\t\t\t\tvalue?.endOnDate ? new Date(value.endOnDate * 1000) : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdisabled={endMode !== RECURRENCE_END_MODE.ON_DATE}\n\t\t\t\t\t\t\tonChange={(picked: Date | Date[]) => {\n\t\t\t\t\t\t\t\tconst dateValue = Array.isArray(picked) ? picked[0] : picked;\n\t\t\t\t\t\t\t\tif (!dateValue) return;\n\t\t\t\t\t\t\t\t// End of the chosen day, so a run landing that day still fires.\n\t\t\t\t\t\t\t\tconst endOfDay = new Date(dateValue);\n\t\t\t\t\t\t\t\tendOfDay.setHours(23, 59, 59, 0);\n\t\t\t\t\t\t\t\tonChange({\n\t\t\t\t\t\t\t\t\tendMode: RECURRENCE_END_MODE.ON_DATE,\n\t\t\t\t\t\t\t\t\tendOnDate: Math.floor(endOfDay.getTime() / 1000),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tcalendarProps={{ minDate: minEndDate }}\n\t\t\t\t\t\t\tpickerStyles={{ top: 8, zIndex: 4 }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</EndDateWrapper>\n\t\t\t\t</Row>\n\t\t\t</EndsRow>\n\t\t</FieldColumn>\n\t);\n};\n"],"names":["RADIO_ACTIVE_COLOR","COLORS","ScheduleEndPicker","value","onChange","minEndDate","dataTest","endMode","RECURRENCE_END_MODE","jsxs","FieldColumn","jsx","FieldLabel","BodySecondary","EndsRow","RadioButton","Row","RunCountInputWrapper","Input","MAX_RECURRENCE_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cAAA,CAC/C;AAAA,YACF;AAAA,YACA,eAAe,EAAE,SAASrB,EAAA;AAAA,YAC1B,cAAc,EAAE,KAAK,GAAG,QAAQ,EAAA;AAAA,UAAE;AAAA,QAAA,EACnC,CACD;AAAA,MAAA,EAAA,CACD;AAAA,IAAA,EAAA,CACD;AAAA,EAAA,GACD;AAEF;"}
@@ -0,0 +1,21 @@
1
+ import { default as React } from 'react';
2
+ import { RecurrenceValue } from './model';
3
+ export interface ScheduleFrequencyPickerProps {
4
+ value: RecurrenceValue;
5
+ onChange: (patch: Partial<RecurrenceValue>) => void;
6
+ /**
7
+ * Width of the frequency menu. Defaults to matching its button — pass a
8
+ * measured width when the button sits in a narrow column and the menu should
9
+ * still be readable.
10
+ */
11
+ frequencyMenuWidth?: string;
12
+ 'data-test'?: string;
13
+ }
14
+ /**
15
+ * Frequency, plus whichever "Repeat on" picker that frequency needs.
16
+ *
17
+ * Daily needs no picker, weekly needs day chips, monthly needs a preset dropdown
18
+ * and — for Custom — the 1-31 date grid. All three live here so a caller does not
19
+ * have to know which control belongs to which frequency.
20
+ */
21
+ export declare const ScheduleFrequencyPicker: React.FC<ScheduleFrequencyPickerProps>;
@@ -0,0 +1,136 @@
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
+ import { COLORS as o } from "../../constants/Theme.js";
3
+ import y from "../../icons/Informational/General/Info.js";
4
+ import { ChipSelectorGroup as O } from "../chip-selector/ChipSelectorGroup.js";
5
+ import { BodySecondary as a, BodyCaption as u } from "../TypographyStyle.js";
6
+ import { RECURRENCE_FREQUENCY as c, MONTHLY_REPEAT_OPTION as h } from "./model.js";
7
+ import { Column as g, FieldsRow as A, DateFieldColumn as C, FieldLabel as s, FrequencyDropdownSlot as M, FieldColumn as b, CaptionWithIcon as m, Row as W, MonthDateGridSlot as N } from "./ScheduleBuilder.styled.js";
8
+ import { ScheduleHelper as P, getSkippedMonthCaption as Y, LAST_DAY_CHIP_VALUE as R, DAY_CHIP_OPTIONS as k, CHIP_WIDTH as v, DATE_CHIP_OPTIONS as w } from "./ScheduleHelper.js";
9
+ import { Dropdown as T } from "../dropdown/Dropdown.js";
10
+ const E = [
11
+ { label: "Daily", value: c.DAILY },
12
+ { label: "Weekly", value: c.WEEKLY },
13
+ { label: "Monthly", value: c.MONTHLY }
14
+ ], H = [
15
+ { label: "First", value: h.FIRST },
16
+ { label: "Last", value: h.LAST },
17
+ { label: "Custom", value: h.CUSTOM }
18
+ ], Q = ({ value: l, onChange: d, frequencyMenuWidth: L, "data-test": D }) => {
19
+ const i = new P(l), f = i.frequency === c.WEEKLY, p = i.frequency === c.MONTHLY, I = p && l?.monthlyRepeatOption === h.CUSTOM, S = Y(l?.datesOfMonth), _ = [
20
+ ...l?.datesOfMonth ?? [],
21
+ ...l?.lastDaySelected ? [R] : []
22
+ ];
23
+ return /* @__PURE__ */ n(g, { gap: 12, "data-test": D, children: [
24
+ /* @__PURE__ */ n(A, { children: [
25
+ /* @__PURE__ */ n(C, { children: [
26
+ /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(a, { color: o.content.primary, children: "Select frequency" }) }),
27
+ /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(
28
+ T,
29
+ {
30
+ size: "default",
31
+ isSearchable: !1,
32
+ isMultiSelect: !1,
33
+ options: E,
34
+ buttonWidth: "100%",
35
+ width: L || "100%",
36
+ placeHolderHeight: "48px",
37
+ placeHolder: "Select frequency",
38
+ value: E.find(
39
+ (t) => t.value === i.frequency
40
+ )?.label,
41
+ onSelect: (t) => {
42
+ const r = Array.isArray(t) ? t[0] : t;
43
+ r?.value && d({
44
+ frequency: r.value
45
+ });
46
+ }
47
+ }
48
+ ) })
49
+ ] }),
50
+ !f && !p && /* @__PURE__ */ e(C, { "aria-hidden": !0 }),
51
+ f && /* @__PURE__ */ n(b, { children: [
52
+ /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(a, { color: o.content.primary, children: "Repeat on" }) }),
53
+ /* @__PURE__ */ e(
54
+ O,
55
+ {
56
+ "data-test": "recurrence-days-of-week",
57
+ ariaLabel: "Repeat on",
58
+ chipWidth: v,
59
+ options: k,
60
+ value: l?.daysOfWeek ?? [],
61
+ onChange: (t) => d({
62
+ daysOfWeek: t.filter(
63
+ (r) => typeof r == "number"
64
+ )
65
+ })
66
+ }
67
+ ),
68
+ i.isMissingWeeklyDays && /* @__PURE__ */ n(m, { children: [
69
+ /* @__PURE__ */ e(y, { size: 16, color: o.content.negative }),
70
+ /* @__PURE__ */ e(u, { color: o.content.negative, children: "Select day(s) above to send this weekly recurring" })
71
+ ] })
72
+ ] }),
73
+ p && /* @__PURE__ */ n(b, { children: [
74
+ /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(a, { color: o.content.primary, children: "Repeat every" }) }),
75
+ /* @__PURE__ */ n(W, { gap: 8, children: [
76
+ /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(
77
+ T,
78
+ {
79
+ size: "default",
80
+ isSearchable: !1,
81
+ isMultiSelect: !1,
82
+ options: H,
83
+ buttonWidth: "100%",
84
+ width: "220px",
85
+ placeHolderHeight: "48px",
86
+ placeHolder: "Select",
87
+ value: H.find(
88
+ (t) => t.value === l?.monthlyRepeatOption
89
+ )?.label,
90
+ onSelect: (t) => {
91
+ const r = Array.isArray(t) ? t[0] : t;
92
+ r?.value && d({
93
+ monthlyRepeatOption: r.value
94
+ });
95
+ }
96
+ }
97
+ ) }),
98
+ /* @__PURE__ */ e(a, { color: o.content.primary, children: "day of the month" })
99
+ ] })
100
+ ] })
101
+ ] }),
102
+ I && /* @__PURE__ */ n(N, { children: [
103
+ /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(a, { color: o.content.primary, children: "Repeat on" }) }),
104
+ /* @__PURE__ */ e(
105
+ O,
106
+ {
107
+ "data-test": "recurrence-dates-of-month",
108
+ ariaLabel: "Repeat on dates",
109
+ chipWidth: v,
110
+ options: w,
111
+ size: "small",
112
+ wrap: !0,
113
+ value: _,
114
+ onChange: (t) => d({
115
+ datesOfMonth: t.filter(
116
+ (r) => typeof r == "number"
117
+ ),
118
+ lastDaySelected: t.includes(R)
119
+ })
120
+ }
121
+ ),
122
+ !!S && /* @__PURE__ */ n(m, { children: [
123
+ /* @__PURE__ */ e(y, { size: 16, color: o.content.secondary }),
124
+ /* @__PURE__ */ e(u, { color: o.content.secondary, children: S })
125
+ ] }),
126
+ i.isMissingMonthlyDates && /* @__PURE__ */ n(m, { children: [
127
+ /* @__PURE__ */ e(y, { size: 16, color: o.content.negative }),
128
+ /* @__PURE__ */ e(u, { color: o.content.negative, children: "Select day(s) above to send this monthly recurring" })
129
+ ] })
130
+ ] })
131
+ ] });
132
+ };
133
+ export {
134
+ Q as ScheduleFrequencyPicker
135
+ };
136
+ //# sourceMappingURL=ScheduleFrequencyPicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScheduleFrequencyPicker.js","sources":["../../../../src/components/schedule-builder/ScheduleFrequencyPicker.tsx"],"sourcesContent":["import React from 'react';\nimport { COLORS } from '../../constants/Theme';\nimport Info from '../../icons/Informational/General/Info';\nimport { ChipSelectorGroup } from '../chip-selector';\nimport { Dropdown, DropdownOption, SingleOption } from '../dropdown';\nimport { BodyCaption, BodySecondary } from '../TypographyStyle';\nimport {\n\tMONTHLY_REPEAT_OPTION,\n\tRECURRENCE_FREQUENCY,\n\tRecurrenceValue,\n} from './model';\nimport {\n\tCaptionWithIcon,\n\tColumn,\n\tDateFieldColumn,\n\tFieldColumn,\n\tFieldLabel,\n\tFieldsRow,\n\tFrequencyDropdownSlot,\n\tMonthDateGridSlot,\n\tRow,\n} from './ScheduleBuilder.styled';\nimport {\n\tCHIP_WIDTH,\n\tDATE_CHIP_OPTIONS,\n\tDAY_CHIP_OPTIONS,\n\tgetSkippedMonthCaption,\n\tLAST_DAY_CHIP_VALUE,\n\tScheduleHelper,\n} from './ScheduleHelper';\n\nconst FREQUENCY_OPTIONS: SingleOption[] = [\n\t{ label: 'Daily', value: RECURRENCE_FREQUENCY.DAILY },\n\t{ label: 'Weekly', value: RECURRENCE_FREQUENCY.WEEKLY },\n\t{ label: 'Monthly', value: RECURRENCE_FREQUENCY.MONTHLY },\n];\n\n/** \"Repeat every\" presets for a monthly recurrence. */\nconst MONTHLY_REPEAT_OPTIONS: SingleOption[] = [\n\t{ label: 'First', value: MONTHLY_REPEAT_OPTION.FIRST },\n\t{ label: 'Last', value: MONTHLY_REPEAT_OPTION.LAST },\n\t{ label: 'Custom', value: MONTHLY_REPEAT_OPTION.CUSTOM },\n];\n\nexport interface ScheduleFrequencyPickerProps {\n\tvalue: RecurrenceValue;\n\tonChange: (patch: Partial<RecurrenceValue>) => void;\n\t/**\n\t * Width of the frequency menu. Defaults to matching its button — pass a\n\t * measured width when the button sits in a narrow column and the menu should\n\t * still be readable.\n\t */\n\tfrequencyMenuWidth?: string;\n\t'data-test'?: string;\n}\n\n/**\n * Frequency, plus whichever \"Repeat on\" picker that frequency needs.\n *\n * Daily needs no picker, weekly needs day chips, monthly needs a preset dropdown\n * and — for Custom — the 1-31 date grid. All three live here so a caller does not\n * have to know which control belongs to which frequency.\n */\nexport const ScheduleFrequencyPicker: React.FC<\n\tScheduleFrequencyPickerProps\n> = ({ value, onChange, frequencyMenuWidth, 'data-test': dataTest }) => {\n\tconst helper = new ScheduleHelper(value);\n\tconst isWeekly = helper.frequency === RECURRENCE_FREQUENCY.WEEKLY;\n\tconst isMonthly = helper.frequency === RECURRENCE_FREQUENCY.MONTHLY;\n\tconst isCustomMonthly =\n\t\tisMonthly && value?.monthlyRepeatOption === MONTHLY_REPEAT_OPTION.CUSTOM;\n\n\tconst skippedMonthCaption = getSkippedMonthCaption(value?.datesOfMonth);\n\n\t/** The last-day sentinel rides alongside the numeric dates in one chip group. */\n\tconst monthlyChipValue: (string | number)[] = [\n\t\t...(value?.datesOfMonth ?? []),\n\t\t...(value?.lastDaySelected ? [LAST_DAY_CHIP_VALUE] : []),\n\t];\n\n\treturn (\n\t\t<Column gap={12} data-test={dataTest}>\n\t\t\t<FieldsRow>\n\t\t\t\t{/*\n Same flex share as the Start date column above it, per the design\n where both fields are 337px halves of the 690px row.\n */}\n\t\t\t\t<DateFieldColumn>\n\t\t\t\t\t<FieldLabel>\n\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\tSelect frequency\n\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t</FieldLabel>\n\t\t\t\t\t<FrequencyDropdownSlot>\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\t\tisSearchable={false}\n\t\t\t\t\t\t\tisMultiSelect={false}\n\t\t\t\t\t\t\toptions={FREQUENCY_OPTIONS}\n\t\t\t\t\t\t\tbuttonWidth=\"100%\"\n\t\t\t\t\t\t\twidth={frequencyMenuWidth || '100%'}\n\t\t\t\t\t\t\tplaceHolderHeight=\"48px\"\n\t\t\t\t\t\t\tplaceHolder=\"Select frequency\"\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tFREQUENCY_OPTIONS.find(\n\t\t\t\t\t\t\t\t\t(option) => option.value === helper.frequency,\n\t\t\t\t\t\t\t\t)?.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonSelect={(\n\t\t\t\t\t\t\t\tselected: DropdownOption | DropdownOption[] | null,\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tconst normalized = (\n\t\t\t\t\t\t\t\t\tArray.isArray(selected) ? selected[0] : selected\n\t\t\t\t\t\t\t\t) as SingleOption | null;\n\t\t\t\t\t\t\t\tif (!normalized?.value) return;\n\t\t\t\t\t\t\t\tonChange({\n\t\t\t\t\t\t\t\t\tfrequency: normalized.value as RECURRENCE_FREQUENCY,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FrequencyDropdownSlot>\n\t\t\t\t</DateFieldColumn>\n\t\t\t\t{/*\n Holds the other half of the row when no picker follows, so the\n frequency field stays the same width as Start date instead of\n stretching across the whole row.\n */}\n\t\t\t\t{!isWeekly && !isMonthly && <DateFieldColumn aria-hidden />}\n\t\t\t\t{isWeekly && (\n\t\t\t\t\t<FieldColumn>\n\t\t\t\t\t\t<FieldLabel>\n\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tRepeat on\n\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t</FieldLabel>\n\t\t\t\t\t\t<ChipSelectorGroup\n\t\t\t\t\t\t\tdata-test=\"recurrence-days-of-week\"\n\t\t\t\t\t\t\tariaLabel=\"Repeat on\"\n\t\t\t\t\t\t\tchipWidth={CHIP_WIDTH}\n\t\t\t\t\t\t\toptions={DAY_CHIP_OPTIONS}\n\t\t\t\t\t\t\tvalue={value?.daysOfWeek ?? []}\n\t\t\t\t\t\t\tonChange={(days) =>\n\t\t\t\t\t\t\t\tonChange({\n\t\t\t\t\t\t\t\t\tdaysOfWeek: days.filter(\n\t\t\t\t\t\t\t\t\t\t(day): day is number => typeof day === 'number',\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{helper.isMissingWeeklyDays && (\n\t\t\t\t\t\t\t<CaptionWithIcon>\n\t\t\t\t\t\t\t\t<Info size={16} color={COLORS.content.negative} />\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.negative}>\n\t\t\t\t\t\t\t\t\tSelect day(s) above to send this weekly recurring\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t</CaptionWithIcon>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</FieldColumn>\n\t\t\t\t)}\n\t\t\t\t{isMonthly && (\n\t\t\t\t\t<FieldColumn>\n\t\t\t\t\t\t<FieldLabel>\n\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tRepeat every\n\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t</FieldLabel>\n\t\t\t\t\t\t<Row gap={8}>\n\t\t\t\t\t\t\t<FrequencyDropdownSlot>\n\t\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\t\t\t\tisSearchable={false}\n\t\t\t\t\t\t\t\t\tisMultiSelect={false}\n\t\t\t\t\t\t\t\t\toptions={MONTHLY_REPEAT_OPTIONS}\n\t\t\t\t\t\t\t\t\tbuttonWidth=\"100%\"\n\t\t\t\t\t\t\t\t\twidth=\"220px\"\n\t\t\t\t\t\t\t\t\tplaceHolderHeight=\"48px\"\n\t\t\t\t\t\t\t\t\tplaceHolder=\"Select\"\n\t\t\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\t\t\tMONTHLY_REPEAT_OPTIONS.find(\n\t\t\t\t\t\t\t\t\t\t\t(option) => option.value === value?.monthlyRepeatOption,\n\t\t\t\t\t\t\t\t\t\t)?.label\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonSelect={(\n\t\t\t\t\t\t\t\t\t\tselected: DropdownOption | DropdownOption[] | null,\n\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\tconst normalized = (\n\t\t\t\t\t\t\t\t\t\t\tArray.isArray(selected) ? selected[0] : selected\n\t\t\t\t\t\t\t\t\t\t) as SingleOption | null;\n\t\t\t\t\t\t\t\t\t\tif (!normalized?.value) return;\n\t\t\t\t\t\t\t\t\t\tonChange({\n\t\t\t\t\t\t\t\t\t\t\tmonthlyRepeatOption:\n\t\t\t\t\t\t\t\t\t\t\t\tnormalized.value as MONTHLY_REPEAT_OPTION,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FrequencyDropdownSlot>\n\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tday of the month\n\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t</Row>\n\t\t\t\t\t</FieldColumn>\n\t\t\t\t)}\n\t\t\t</FieldsRow>\n\n\t\t\t{isCustomMonthly && (\n\t\t\t\t<MonthDateGridSlot>\n\t\t\t\t\t<FieldLabel>\n\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\tRepeat on\n\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t</FieldLabel>\n\t\t\t\t\t<ChipSelectorGroup\n\t\t\t\t\t\tdata-test=\"recurrence-dates-of-month\"\n\t\t\t\t\t\tariaLabel=\"Repeat on dates\"\n\t\t\t\t\t\tchipWidth={CHIP_WIDTH}\n\t\t\t\t\t\toptions={DATE_CHIP_OPTIONS}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\twrap\n\t\t\t\t\t\tvalue={monthlyChipValue}\n\t\t\t\t\t\tonChange={(selected) =>\n\t\t\t\t\t\t\tonChange({\n\t\t\t\t\t\t\t\tdatesOfMonth: selected.filter(\n\t\t\t\t\t\t\t\t\t(item): item is number => typeof item === 'number',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tlastDaySelected: selected.includes(LAST_DAY_CHIP_VALUE),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{!!skippedMonthCaption && (\n\t\t\t\t\t\t<CaptionWithIcon>\n\t\t\t\t\t\t\t<Info size={16} color={COLORS.content.secondary} />\n\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t{skippedMonthCaption}\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t</CaptionWithIcon>\n\t\t\t\t\t)}\n\t\t\t\t\t{helper.isMissingMonthlyDates && (\n\t\t\t\t\t\t<CaptionWithIcon>\n\t\t\t\t\t\t\t<Info size={16} color={COLORS.content.negative} />\n\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.negative}>\n\t\t\t\t\t\t\t\tSelect day(s) above to send this monthly recurring\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t</CaptionWithIcon>\n\t\t\t\t\t)}\n\t\t\t\t</MonthDateGridSlot>\n\t\t\t)}\n\t\t</Column>\n\t);\n};\n"],"names":["FREQUENCY_OPTIONS","RECURRENCE_FREQUENCY","MONTHLY_REPEAT_OPTIONS","MONTHLY_REPEAT_OPTION","ScheduleFrequencyPicker","value","onChange","frequencyMenuWidth","dataTest","helper","ScheduleHelper","isWeekly","isMonthly","isCustomMonthly","skippedMonthCaption","getSkippedMonthCaption","monthlyChipValue","LAST_DAY_CHIP_VALUE","jsxs","Column","FieldsRow","DateFieldColumn","jsx","FieldLabel","BodySecondary","COLORS","FrequencyDropdownSlot","Dropdown","option","selected","normalized","FieldColumn","ChipSelectorGroup","CHIP_WIDTH","DAY_CHIP_OPTIONS","days","day","CaptionWithIcon","Info","BodyCaption","Row","MonthDateGridSlot","DATE_CHIP_OPTIONS","item"],"mappings":";;;;;;;;;AA+BA,MAAMA,IAAoC;AAAA,EACzC,EAAE,OAAO,SAAS,OAAOC,EAAqB,MAAA;AAAA,EAC9C,EAAE,OAAO,UAAU,OAAOA,EAAqB,OAAA;AAAA,EAC/C,EAAE,OAAO,WAAW,OAAOA,EAAqB,QAAA;AACjD,GAGMC,IAAyC;AAAA,EAC9C,EAAE,OAAO,SAAS,OAAOC,EAAsB,MAAA;AAAA,EAC/C,EAAE,OAAO,QAAQ,OAAOA,EAAsB,KAAA;AAAA,EAC9C,EAAE,OAAO,UAAU,OAAOA,EAAsB,OAAA;AACjD,GAqBaC,IAET,CAAC,EAAE,OAAAC,GAAO,UAAAC,GAAU,oBAAAC,GAAoB,aAAaC,QAAe;AACvE,QAAMC,IAAS,IAAIC,EAAeL,CAAK,GACjCM,IAAWF,EAAO,cAAcR,EAAqB,QACrDW,IAAYH,EAAO,cAAcR,EAAqB,SACtDY,IACLD,KA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import { RECURRENCE_END_MODE, RECURRENCE_FREQUENCY, RecurrenceSummary, RecurrenceValue } from './model';
3
+ /** How many upcoming runs the preview shows by default. */
4
+ export declare const UPCOMING_RUNS_PREVIEW_COUNT = 3;
5
+ /** Upper bound on `endAfterRuns`, matching the 3-digit input in the design. */
6
+ export declare const MAX_RECURRENCE_RUNS = 999;
7
+ /**
8
+ * Width of a single chip in the "Repeat on" pickers.
9
+ *
10
+ * Shared by the weekly day chips and the monthly date chips: both grids are
11
+ * drawn to the same 44px square in the design, and the monthly grid's 337px
12
+ * width assumes it, so the two cannot be sized independently.
13
+ */
14
+ export declare const CHIP_WIDTH = 44;
15
+ /** Highest date the monthly grid offers. */
16
+ export declare const MAX_DATE_OF_MONTH = 31;
17
+ /** Sentinel chip value for "Last day of the month", which is not a date. */
18
+ export declare const LAST_DAY_CHIP_VALUE = "LAST_DAY";
19
+ /** Short day labels, indexed by JS day number (0 = Sunday). */
20
+ export declare const DAY_LABELS: string[];
21
+ /** Selecting all seven days is stored as DAILY rather than a full weekly set. */
22
+ export declare const DAYS_IN_WEEK = 7;
23
+ /**
24
+ * Chips for the weekly "Repeat on" picker. Only the first letter is shown, so
25
+ * each chip carries the full day name for screen readers — S, T and S repeat.
26
+ */
27
+ export declare const DAY_CHIP_OPTIONS: ChipOption[];
28
+ /**
29
+ * Chips for the monthly "Repeat on" grid — 1 to 31, then "Last day of the
30
+ * month" as an independent option rather than an alias for the 31st.
31
+ */
32
+ export declare const DATE_CHIP_OPTIONS: ChipOption[];
33
+ /**
34
+ * "1st", "22nd", "13th" — the 11/12/13 exception is why this is not a plain
35
+ * lookup on the last digit.
36
+ */
37
+ export declare const ordinal: (value: number) => string;
38
+ /**
39
+ * "Mon", "Mon and Tue", "Mon, Tue and Thu" — no Oxford comma, and always "and"
40
+ * rather than "&". Shared by the weekly day names and the monthly ordinals.
41
+ */
42
+ export declare const joinList: (items: string[]) => string;
43
+ /** Caption warning that a chosen date does not exist in every month. */
44
+ export declare const getSkippedMonthCaption: (datesOfMonth: number[] | undefined) => string | null;
45
+ /**
46
+ * Works out when a recurring campaign actually runs.
47
+ *
48
+ * Kept free of React so the schedule preview and the eventual publish payload
49
+ * can both read run dates from one place.
50
+ */
51
+ export declare class ScheduleHelper {
52
+ private readonly recurrence;
53
+ constructor(recurrence: RecurrenceValue | undefined);
54
+ get frequency(): RECURRENCE_FREQUENCY;
55
+ get endMode(): RECURRENCE_END_MODE;
56
+ /** Days a weekly recurrence repeats on, as JS day indices. */
57
+ get daysOfWeek(): number[];
58
+ /** Dates a monthly recurrence repeats on (1–31). */
59
+ get datesOfMonth(): number[];
60
+ /** Whether a monthly recurrence also runs on the last day of every month. */
61
+ get lastDaySelected(): boolean;
62
+ /** A weekly recurrence cannot run until at least one day is picked. */
63
+ get isMissingWeeklyDays(): boolean;
64
+ /** A monthly recurrence needs at least one date, or the last-day option. */
65
+ get isMissingMonthlyDates(): boolean;
66
+ /** True when the current selection cannot produce any run dates. */
67
+ get isMissingRunDays(): boolean;
68
+ /**
69
+ * Advances a date by one day.
70
+ *
71
+ * Every frequency walks day by day so `isRunDay` decides what counts. Monthly
72
+ * cannot use `setMonth`: it rolls a 31st into the following month for shorter
73
+ * months (31 Jan -> 3 Mar), whereas a missing date must skip that month
74
+ * outright.
75
+ */
76
+ private addInterval;
77
+ /** Last calendar date of the month the given date falls in. */
78
+ private static lastDateOfMonth;
79
+ /** Whether a candidate date is one the campaign actually runs on. */
80
+ private isRunDay;
81
+ /**
82
+ * Next `limit` run dates from `startDate`, respecting the end rule.
83
+ *
84
+ * Returns fewer than `limit` when the recurrence ends first, which is what
85
+ * lets the preview stop honestly instead of inventing runs.
86
+ */
87
+ computeUpcomingRuns(startDate: Date | null | undefined, limit?: number): Date[];
88
+ /**
89
+ * The days a weekly recurrence runs on, in Monday-first display order rather
90
+ * than the Sunday-first order the chip values are indexed by.
91
+ *
92
+ * Mon–Fri exactly collapses to "weekday", Sat+Sun to "weekend". All seven is
93
+ * not handled here — that is normalised to DAILY when the day is selected.
94
+ */
95
+ private get weeklyDayPhrase();
96
+ private get monthlyDatePhrase();
97
+ /**
98
+ * The semibold phrase after "Repeats". Weekly and monthly name the days they
99
+ * run on; daily is a plain adverb.
100
+ */
101
+ private get frequencyLabel();
102
+ /** The text following the time, which differs per end mode. */
103
+ private get endClause();
104
+ /**
105
+ * Summary shown under the upcoming runs, split so the frequency and time can
106
+ * be rendered in semibold as the design shows:
107
+ * "Repeats **daily** at **10:00 AM** with no end date, you can cancel anytime."
108
+ */
109
+ buildSummary(runs: Date[]): RecurrenceSummary | null;
110
+ }