@councilbox/councilbox-ui 2.0.54 → 2.0.55

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 (150) hide show
  1. package/Accordion.js +3 -0
  2. package/Alert.js +3 -0
  3. package/Avatar.js +3 -0
  4. package/AvatarGroup.js +3 -0
  5. package/Block.js +3 -0
  6. package/Button.js +3 -0
  7. package/ButtonBasic.js +3 -0
  8. package/Checkbox.js +3 -0
  9. package/DatePicker.js +3 -0
  10. package/DateRangePicker.js +3 -0
  11. package/DateTimePicker.js +3 -0
  12. package/DragDrop.js +3 -0
  13. package/DrawerPanel.js +3 -0
  14. package/DropDown.js +3 -0
  15. package/EnhancedTable.js +3 -0
  16. package/FabButton.js +3 -0
  17. package/Grid.js +3 -0
  18. package/Header.js +3 -0
  19. package/IconButton.js +3 -0
  20. package/IconButtonSquare.js +3 -0
  21. package/IconFont.js +3 -0
  22. package/InputAutocomplete.js +3 -0
  23. package/InputPassword.js +3 -0
  24. package/InputText.js +3 -0
  25. package/InputTextArea.js +3 -0
  26. package/LoadingSection.js +3 -0
  27. package/MenuItem.js +3 -0
  28. package/MenuLateralLeft.js +3 -0
  29. package/MenuLateralRight.js +3 -0
  30. package/Modal.js +3 -0
  31. package/Radio.js +3 -0
  32. package/RichTextInput.js +3 -0
  33. package/Scrollbar.js +3 -0
  34. package/ScrollbarNew.js +3 -0
  35. package/SelectInput.js +3 -0
  36. package/Slider.js +3 -0
  37. package/Spacing.js +3 -0
  38. package/Stars.js +3 -0
  39. package/Stepper.js +3 -0
  40. package/Table.js +3 -0
  41. package/TableBody.js +3 -0
  42. package/TableCell.js +3 -0
  43. package/TableContainer.js +3 -0
  44. package/TableHead.js +3 -0
  45. package/TableRow.js +3 -0
  46. package/TableSortLabel.js +3 -0
  47. package/Tabs.js +3 -0
  48. package/Tag.js +3 -0
  49. package/TextInput.js +3 -0
  50. package/ThemeProvider.js +3 -0
  51. package/TimePicker.js +3 -0
  52. package/Timeline.js +3 -0
  53. package/ToastProvider.js +3 -0
  54. package/Toggle.js +3 -0
  55. package/Tooltip.js +3 -0
  56. package/Typography.js +3 -0
  57. package/dist/HOCs/useDynamicStyles.js +25 -24
  58. package/dist/build-index.js +70 -0
  59. package/dist/components/1.Introduction.stories.mdx +4 -1
  60. package/dist/components/2.Changelog.stories.mdx +15 -3
  61. package/dist/components/DatePicker/Calendar.js +243 -0
  62. package/dist/components/DatePicker/DatePicker.css +197 -0
  63. package/dist/components/DatePicker/DatePicker.js +384 -0
  64. package/dist/components/DatePicker/DatePicker.stories.js +180 -0
  65. package/dist/components/DatePicker/dateUtils.js +478 -0
  66. package/dist/components/DateRangePicker/DateRangePicker.css +41 -0
  67. package/dist/components/DateRangePicker/DateRangePicker.js +435 -0
  68. package/dist/components/DateRangePicker/DateRangePicker.stories.js +147 -0
  69. package/dist/components/DateRangePicker/RangeCalendar.js +188 -0
  70. package/dist/components/DateTimePicker/DateTimePicker.css +4 -0
  71. package/dist/components/DateTimePicker/DateTimePicker.js +481 -0
  72. package/dist/components/DateTimePicker/DateTimePicker.stories.js +144 -0
  73. package/dist/components/DateTimePicker/TimeColumns.css +46 -0
  74. package/dist/components/DateTimePicker/TimeColumns.js +175 -0
  75. package/dist/components/DragDrop/DragDrop.js +4 -1
  76. package/dist/components/DropDown/DesignDropDown.stories.js +8 -0
  77. package/dist/components/DropDown/DropDown.js +14 -4
  78. package/dist/components/Header/Header.js +32 -10
  79. package/dist/components/IconButton/IconButton.js +3 -2
  80. package/dist/components/IconButtonSquare/IconButtonSquare.js +3 -3
  81. package/dist/components/InputAutocomplete/InputAutocomplete.js +2 -2
  82. package/dist/components/InputText/InputText.css +10 -5
  83. package/dist/components/InputText/InputText.js +4 -4
  84. package/dist/components/MenuItem/MenuItem.js +65 -61
  85. package/dist/components/MenuLateralRight/MenuLateralRight.js +18 -2
  86. package/dist/components/Modal/Modal.js +3 -1
  87. package/dist/components/RichTextInput/DesignRichTextInput.stories.js +119 -0
  88. package/dist/components/RichTextInput/RichTextInput.css +309 -0
  89. package/dist/components/RichTextInput/RichTextInput.js +851 -0
  90. package/dist/components/RichTextInput/RichTextInput.stories.js +33 -0
  91. package/dist/components/Ripple/DesignRipple.js +17 -0
  92. package/dist/components/ScrollbarNew/DesignScrollbarNew.js +24 -0
  93. package/dist/components/ScrollbarNew/ScrollbarNew.css +79 -0
  94. package/dist/components/ScrollbarNew/ScrollbarNew.js +426 -0
  95. package/dist/components/ScrollbarNew/ScrollbarNew.stories.js +37 -0
  96. package/dist/components/SelectInput/SelectInput.js +85 -78
  97. package/dist/components/Tabs/DesignTabs.js +1 -1
  98. package/dist/components/Tabs/Tabs.js +0 -1
  99. package/dist/components/TimePicker/TimePicker.css +3 -0
  100. package/dist/components/TimePicker/TimePicker.js +359 -0
  101. package/dist/components/TimePicker/TimePicker.stories.js +132 -0
  102. package/dist/components/Toast/DesignToast.stories.js +174 -0
  103. package/dist/components/Toast/Toast.css +154 -0
  104. package/dist/components/Toast/Toast.js +165 -0
  105. package/dist/components/Toast/Toast.stories.js +33 -0
  106. package/dist/components/Toast/ToastProvider.js +33 -0
  107. package/dist/components/Toast/ToastRoot.js +89 -0
  108. package/dist/components/Toast/toastStore.js +127 -0
  109. package/dist/components/Toast/useToast.js +42 -0
  110. package/dist/components/Toggle/Toggle.js +20 -14
  111. package/dist/components/Tooltip/Tooltip.js +7 -2
  112. package/dist/styles/styleFont.css +1 -1
  113. package/dist/styles/zIndexConsts.css +2 -0
  114. package/package.json +63 -3
  115. package/toast.js +7 -0
  116. package/useCouncilboxTheme.js +7 -0
  117. package/useToast.js +7 -0
  118. package/dist/components/Accordion/AccordionOld.css +0 -16
  119. package/dist/components/Accordion/AccordionOld.js +0 -91
  120. package/dist/components/Avatar/AvatarOld.js +0 -124
  121. package/dist/components/ButtonBasic/ButtonBasicOld.css +0 -41
  122. package/dist/components/ButtonBasic/ButtonBasicOld.js +0 -211
  123. package/dist/components/Checkbox/CheckboxOld.css +0 -31
  124. package/dist/components/Checkbox/CheckboxOld.js +0 -96
  125. package/dist/components/DrawerPanel/DrawerPanelOld.css +0 -56
  126. package/dist/components/DrawerPanel/DrawerPanelOld.js +0 -211
  127. package/dist/components/DropDown/DropDownOld.css +0 -3
  128. package/dist/components/DropDown/DropDownOld.js +0 -154
  129. package/dist/components/Grid/GridItemOld.js +0 -38
  130. package/dist/components/Grid/GridOld.css +0 -0
  131. package/dist/components/Grid/GridOld.js +0 -46
  132. package/dist/components/IconButton/IconButtonOld.css +0 -0
  133. package/dist/components/IconButton/IconButtonOld.js +0 -122
  134. package/dist/components/IconButtonSquare/IconButtonSquareOld.css +0 -43
  135. package/dist/components/IconButtonSquare/IconButtonSquareOld.js +0 -115
  136. package/dist/components/InputAutocomplete/InputAutocompleteOld.css +0 -5
  137. package/dist/components/InputAutocomplete/InputAutocompleteOld.js +0 -159
  138. package/dist/components/InputText/InputTextOld.css +0 -10
  139. package/dist/components/InputText/InputTextOld.js +0 -314
  140. package/dist/components/MenuItem/MenuItemOld.js +0 -123
  141. package/dist/components/Modal/ModalOld.css +0 -3
  142. package/dist/components/Modal/ModalOld.js +0 -213
  143. package/dist/components/RadioButton/RadioOld.css +0 -31
  144. package/dist/components/RadioButton/RadioOld.js +0 -126
  145. package/dist/components/SelectInput/SelectInputOld.css +0 -17
  146. package/dist/components/SelectInput/SelectInputOld.js +0 -296
  147. package/dist/components/Table/TableOld.css +0 -79
  148. package/dist/components/Table/TableOld.js +0 -133
  149. package/dist/components/Tabs/TabsOld.js +0 -78
  150. package/dist/components/Typography/TypographyOld.js +0 -119
@@ -0,0 +1,478 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.toJsDate = exports.startOfDay = exports.setTimeFromDate = exports.setDayFromDate = exports.parseDate = exports.pad2 = exports.isValidDate = exports.isTimeDisabled = exports.isSameMonth = exports.isSameDay = exports.isDateDisabled = exports.isBeforeDay = exports.isAfterDay = exports.getWeekdayNames = exports.getUIText = exports.getMonthNames = exports.getMonthMatrix = exports.getMeridiemText = exports.getLocalePrefersAmPm = exports.getLocaleDateFormat = exports.getDateValueKey = exports.formatDate = exports.addYears = exports.addMonths = exports.addDays = exports.MONTHS_ES = exports.DEFAULT_LOCALE = exports.DAYS_SHORT_ES = void 0;
7
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
+ var DEFAULT_LOCALE = 'es-ES';
14
+
15
+ // Fallbacks only used if Intl.DateTimeFormat throws for an unrecognized locale tag.
16
+ exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
17
+ var DAYS_SHORT_ES = ['L', 'M', 'X', 'J', 'V', 'S', 'D'];
18
+ exports.DAYS_SHORT_ES = DAYS_SHORT_ES;
19
+ var MONTHS_ES = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'];
20
+ exports.MONTHS_ES = MONTHS_ES;
21
+ var UI_TEXT_BY_LANG = {
22
+ es: {
23
+ cancelText: 'Cancelar',
24
+ okText: 'Aceptar',
25
+ clearText: 'Borrar fecha',
26
+ openCalendarText: 'Abrir calendario',
27
+ openDateTimeText: 'Abrir selector de fecha y hora',
28
+ pickerLabel: 'Selector de fecha',
29
+ pickerDateTimeLabel: 'Selector de fecha y hora',
30
+ prevText: 'Anterior',
31
+ nextText: 'Siguiente',
32
+ startLabel: 'Fecha inicio',
33
+ endLabel: 'Fecha fin',
34
+ rangeLabel: 'Selector de rango de fechas',
35
+ openTimeText: 'Abrir selector de hora',
36
+ pickerTimeLabel: 'Selector de hora'
37
+ },
38
+ en: {
39
+ cancelText: 'Cancel',
40
+ okText: 'OK',
41
+ clearText: 'Clear date',
42
+ openCalendarText: 'Open calendar',
43
+ openDateTimeText: 'Open date and time picker',
44
+ pickerLabel: 'Date picker',
45
+ pickerDateTimeLabel: 'Date and time picker',
46
+ prevText: 'Previous',
47
+ nextText: 'Next',
48
+ startLabel: 'Start date',
49
+ endLabel: 'End date',
50
+ rangeLabel: 'Date range picker',
51
+ openTimeText: 'Open time picker',
52
+ pickerTimeLabel: 'Time picker'
53
+ },
54
+ fr: {
55
+ cancelText: 'Annuler',
56
+ okText: 'OK',
57
+ clearText: 'Effacer la date',
58
+ openCalendarText: 'Ouvrir le calendrier',
59
+ openDateTimeText: 'Ouvrir le sélecteur de date et heure',
60
+ pickerLabel: 'Sélecteur de date',
61
+ pickerDateTimeLabel: 'Sélecteur de date et heure',
62
+ prevText: 'Précédent',
63
+ nextText: 'Suivant',
64
+ startLabel: 'Date de début',
65
+ endLabel: 'Date de fin',
66
+ rangeLabel: 'Sélecteur de plage de dates',
67
+ openTimeText: "Ouvrir le sélecteur d'heure",
68
+ pickerTimeLabel: "Sélecteur d'heure"
69
+ },
70
+ de: {
71
+ cancelText: 'Abbrechen',
72
+ okText: 'OK',
73
+ clearText: 'Datum löschen',
74
+ openCalendarText: 'Kalender öffnen',
75
+ openDateTimeText: 'Datums- und Zeitauswahl öffnen',
76
+ pickerLabel: 'Datumsauswahl',
77
+ pickerDateTimeLabel: 'Datums- und Zeitauswahl',
78
+ prevText: 'Zurück',
79
+ nextText: 'Weiter',
80
+ startLabel: 'Startdatum',
81
+ endLabel: 'Enddatum',
82
+ rangeLabel: 'Datumsbereichsauswahl',
83
+ openTimeText: 'Zeitauswahl öffnen',
84
+ pickerTimeLabel: 'Zeitauswahl'
85
+ },
86
+ pt: {
87
+ cancelText: 'Cancelar',
88
+ okText: 'OK',
89
+ clearText: 'Limpar data',
90
+ openCalendarText: 'Abrir calendário',
91
+ openDateTimeText: 'Abrir seletor de data e hora',
92
+ pickerLabel: 'Seletor de data',
93
+ pickerDateTimeLabel: 'Seletor de data e hora',
94
+ prevText: 'Anterior',
95
+ nextText: 'Próximo',
96
+ startLabel: 'Data de início',
97
+ endLabel: 'Data de fim',
98
+ rangeLabel: 'Seletor de intervalo de datas',
99
+ openTimeText: 'Abrir seletor de hora',
100
+ pickerTimeLabel: 'Seletor de hora'
101
+ },
102
+ it: {
103
+ cancelText: 'Annulla',
104
+ okText: 'OK',
105
+ clearText: 'Cancella data',
106
+ openCalendarText: 'Apri calendario',
107
+ openDateTimeText: 'Apri selettore data e ora',
108
+ pickerLabel: 'Selettore data',
109
+ pickerDateTimeLabel: 'Selettore data e ora',
110
+ prevText: 'Precedente',
111
+ nextText: 'Successivo',
112
+ startLabel: 'Data di inizio',
113
+ endLabel: 'Data di fine',
114
+ rangeLabel: 'Selettore intervallo di date',
115
+ openTimeText: 'Apri selettore ora',
116
+ pickerTimeLabel: 'Selettore ora'
117
+ }
118
+ };
119
+ var getLanguage = function getLanguage(locale) {
120
+ return (locale || DEFAULT_LOCALE).slice(0, 2).toLowerCase();
121
+ };
122
+
123
+ // Real, browser-native translations for month/weekday/AM-PM names, for any
124
+ // locale the runtime supports — no moment/date-fns dependency required. A
125
+ // consumer that already uses one of those libraries can still override any
126
+ // of this via the `months`/`weekDays`/`localeText` props (e.g. feeding them
127
+ // moment.months() or a date-fns locale's names).
128
+ var getMonthNames = function getMonthNames() {
129
+ var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_LOCALE;
130
+ var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'long';
131
+ try {
132
+ var formatter = new Intl.DateTimeFormat(locale, {
133
+ month: width,
134
+ timeZone: 'UTC'
135
+ });
136
+ return Array.from({
137
+ length: 12
138
+ }, function (_, month) {
139
+ return formatter.format(new Date(Date.UTC(2000, month, 1)));
140
+ });
141
+ } catch (e) {
142
+ return MONTHS_ES;
143
+ }
144
+ };
145
+ exports.getMonthNames = getMonthNames;
146
+ var getWeekdayNames = function getWeekdayNames() {
147
+ var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_LOCALE;
148
+ var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'short';
149
+ try {
150
+ var formatter = new Intl.DateTimeFormat(locale, {
151
+ weekday: width,
152
+ timeZone: 'UTC'
153
+ });
154
+ // 2000-01-03 is a Monday (UTC), so this yields Monday-first ordering.
155
+ return Array.from({
156
+ length: 7
157
+ }, function (_, day) {
158
+ return formatter.format(new Date(Date.UTC(2000, 0, 3 + day)));
159
+ });
160
+ } catch (e) {
161
+ return DAYS_SHORT_ES;
162
+ }
163
+ };
164
+ exports.getWeekdayNames = getWeekdayNames;
165
+ var getMeridiemText = function getMeridiemText() {
166
+ var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_LOCALE;
167
+ var hours24 = arguments.length > 1 ? arguments[1] : undefined;
168
+ try {
169
+ var parts = new Intl.DateTimeFormat(locale, {
170
+ hour: 'numeric',
171
+ hour12: true
172
+ }).formatToParts(new Date(2000, 0, 1, hours24));
173
+ var dayPeriod = parts.find(function (part) {
174
+ return part.type === 'dayPeriod';
175
+ });
176
+ return dayPeriod ? dayPeriod.value : hours24 < 12 ? 'AM' : 'PM';
177
+ } catch (e) {
178
+ return hours24 < 12 ? 'AM' : 'PM';
179
+ }
180
+ };
181
+
182
+ // Derives the locale's natural day/month/year order (and separators) via
183
+ // Intl, e.g. 'MM/dd/yyyy' for en-US, 'dd/MM/yyyy' for es-ES, 'dd.MM.yyyy' for de-DE.
184
+ exports.getMeridiemText = getMeridiemText;
185
+ var getLocaleDateFormat = function getLocaleDateFormat() {
186
+ var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_LOCALE;
187
+ try {
188
+ var parts = new Intl.DateTimeFormat(locale, {
189
+ year: 'numeric',
190
+ month: '2-digit',
191
+ day: '2-digit'
192
+ }).formatToParts(new Date(2000, 0, 1));
193
+ var tokenByType = {
194
+ year: 'yyyy',
195
+ month: 'MM',
196
+ day: 'dd'
197
+ };
198
+ return parts.map(function (part) {
199
+ return tokenByType[part.type] || part.value;
200
+ }).join('');
201
+ } catch (e) {
202
+ return 'dd/MM/yyyy';
203
+ }
204
+ };
205
+ exports.getLocaleDateFormat = getLocaleDateFormat;
206
+ var getLocalePrefersAmPm = function getLocalePrefersAmPm() {
207
+ var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_LOCALE;
208
+ try {
209
+ return !!new Intl.DateTimeFormat(locale, {
210
+ hour: 'numeric'
211
+ }).resolvedOptions().hour12;
212
+ } catch (e) {
213
+ return false;
214
+ }
215
+ };
216
+
217
+ // Falls back to English (rather than Spanish) for a language we don't have
218
+ // chrome text for, since English is the safer universal default — a
219
+ // consumer can always override any of these via the `localeText` prop.
220
+ exports.getLocalePrefersAmPm = getLocalePrefersAmPm;
221
+ var getUIText = function getUIText() {
222
+ var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_LOCALE;
223
+ var overrides = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
224
+ return _objectSpread(_objectSpread({}, UI_TEXT_BY_LANG[getLanguage(locale)] || UI_TEXT_BY_LANG.en), overrides);
225
+ };
226
+ exports.getUIText = getUIText;
227
+ var isValidDate = function isValidDate(date) {
228
+ return date instanceof Date && !Number.isNaN(date.getTime());
229
+ };
230
+
231
+ // Accepts a native Date, a moment/dayjs instance (duck-typed via `.toDate()`
232
+ // so this library never needs those as a dependency), an ISO string, or a
233
+ // timestamp — and normalizes it to a native Date (or null). Every component
234
+ // runs incoming `value`/`defaultValue`/`minDate`/`maxDate`/etc. through this,
235
+ // so a consumer already using moment or dayjs elsewhere in their app can pass
236
+ // those values straight in without converting them first.
237
+ exports.isValidDate = isValidDate;
238
+ var toJsDate = function toJsDate(value) {
239
+ if (value === null || value === undefined || value === '') return null;
240
+ if (value instanceof Date) return isValidDate(value) ? value : null;
241
+ if (_typeof(value) === 'object' && typeof value.toDate === 'function') {
242
+ var converted = value.toDate();
243
+ return isValidDate(converted) ? converted : null;
244
+ }
245
+ if (typeof value === 'string' || typeof value === 'number') {
246
+ var parsed = new Date(value);
247
+ return isValidDate(parsed) ? parsed : null;
248
+ }
249
+ return null;
250
+ };
251
+
252
+ // A stable primitive to key React deps/memos on, for a value that will be
253
+ // run through toJsDate(). Native Date, moment, and dayjs all override
254
+ // `.valueOf()` to return their millisecond timestamp — a real moment/dayjs
255
+ // instance's `.toDate()` returns a NEW Date object on every call (even for
256
+ // the same instant), so memoizing on the Date reference itself would recompute
257
+ // (and re-render) on every render, indefinitely. Keying on `.valueOf()`
258
+ // instead gives a plain number that stays `===`-stable across renders as
259
+ // long as the underlying instant hasn't actually changed.
260
+ exports.toJsDate = toJsDate;
261
+ var getDateValueKey = function getDateValueKey(value) {
262
+ if (value === null || value === undefined) return value;
263
+ if (_typeof(value) === 'object' && typeof value.valueOf === 'function') return value.valueOf();
264
+ return value;
265
+ };
266
+ exports.getDateValueKey = getDateValueKey;
267
+ var pad2 = function pad2(num) {
268
+ return String(num).padStart(2, '0');
269
+ };
270
+ exports.pad2 = pad2;
271
+ var cloneDate = function cloneDate(date) {
272
+ return new Date(date.getTime());
273
+ };
274
+ var startOfDay = function startOfDay(date) {
275
+ var next = cloneDate(date);
276
+ next.setHours(0, 0, 0, 0);
277
+ return next;
278
+ };
279
+ exports.startOfDay = startOfDay;
280
+ var isSameDay = function isSameDay(a, b) {
281
+ return isValidDate(a) && isValidDate(b) && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
282
+ };
283
+ exports.isSameDay = isSameDay;
284
+ var isSameMonth = function isSameMonth(a, b) {
285
+ return isValidDate(a) && isValidDate(b) && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
286
+ };
287
+ exports.isSameMonth = isSameMonth;
288
+ var isBeforeDay = function isBeforeDay(a, b) {
289
+ return isValidDate(a) && isValidDate(b) && startOfDay(a).getTime() < startOfDay(b).getTime();
290
+ };
291
+ exports.isBeforeDay = isBeforeDay;
292
+ var isAfterDay = function isAfterDay(a, b) {
293
+ return isValidDate(a) && isValidDate(b) && startOfDay(a).getTime() > startOfDay(b).getTime();
294
+ };
295
+ exports.isAfterDay = isAfterDay;
296
+ var addDays = function addDays(date, amount) {
297
+ var next = cloneDate(date);
298
+ next.setDate(next.getDate() + amount);
299
+ return next;
300
+ };
301
+ exports.addDays = addDays;
302
+ var addMonths = function addMonths(date, amount) {
303
+ var next = cloneDate(date);
304
+ var day = next.getDate();
305
+ next.setDate(1);
306
+ next.setMonth(next.getMonth() + amount);
307
+ var daysInTargetMonth = new Date(next.getFullYear(), next.getMonth() + 1, 0).getDate();
308
+ next.setDate(Math.min(day, daysInTargetMonth));
309
+ return next;
310
+ };
311
+ exports.addMonths = addMonths;
312
+ var addYears = function addYears(date, amount) {
313
+ return addMonths(date, amount * 12);
314
+ };
315
+ exports.addYears = addYears;
316
+ var setDayFromDate = function setDayFromDate(base, dayDate) {
317
+ var next = cloneDate(base);
318
+ next.setFullYear(dayDate.getFullYear(), dayDate.getMonth(), dayDate.getDate());
319
+ return next;
320
+ };
321
+ exports.setDayFromDate = setDayFromDate;
322
+ var setTimeFromDate = function setTimeFromDate(base, _ref) {
323
+ var hours = _ref.hours,
324
+ minutes = _ref.minutes,
325
+ seconds = _ref.seconds;
326
+ var next = cloneDate(base);
327
+ if (hours !== undefined) next.setHours(hours);
328
+ if (minutes !== undefined) next.setMinutes(minutes);
329
+ if (seconds !== undefined) next.setSeconds(seconds, 0);
330
+ return next;
331
+ };
332
+ exports.setTimeFromDate = setTimeFromDate;
333
+ var getMonthMatrix = function getMonthMatrix(year, month) {
334
+ var firstOfMonth = new Date(year, month, 1);
335
+ var firstWeekday = (firstOfMonth.getDay() + 6) % 7;
336
+ var cursor = addDays(firstOfMonth, -firstWeekday);
337
+ var weeks = [];
338
+ for (var week = 0; week < 6; week++) {
339
+ var days = [];
340
+ for (var day = 0; day < 7; day++) {
341
+ days.push(cursor);
342
+ cursor = addDays(cursor, 1);
343
+ }
344
+ weeks.push(days);
345
+ }
346
+ return weeks;
347
+ };
348
+ exports.getMonthMatrix = getMonthMatrix;
349
+ var isDateDisabled = function isDateDisabled(date) {
350
+ var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
351
+ minDate = _ref2.minDate,
352
+ maxDate = _ref2.maxDate,
353
+ disablePast = _ref2.disablePast,
354
+ disableFuture = _ref2.disableFuture,
355
+ shouldDisableDate = _ref2.shouldDisableDate;
356
+ if (!isValidDate(date)) return true;
357
+ var day = startOfDay(date);
358
+ if (disablePast && day < startOfDay(new Date())) return true;
359
+ if (disableFuture && day > startOfDay(new Date())) return true;
360
+ if (minDate && isValidDate(minDate) && day < startOfDay(minDate)) return true;
361
+ if (maxDate && isValidDate(maxDate) && day > startOfDay(maxDate)) return true;
362
+ if (shouldDisableDate && shouldDisableDate(day)) return true;
363
+ return false;
364
+ };
365
+ exports.isDateDisabled = isDateDisabled;
366
+ var isTimeDisabled = function isTimeDisabled(date) {
367
+ var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
368
+ minTime = _ref3.minTime,
369
+ maxTime = _ref3.maxTime,
370
+ minDateTime = _ref3.minDateTime,
371
+ maxDateTime = _ref3.maxDateTime;
372
+ if (!isValidDate(date)) return false;
373
+ var min = minDateTime || minTime;
374
+ var max = maxDateTime || maxTime;
375
+ if (min && isValidDate(min) && date < min) return true;
376
+ if (max && isValidDate(max) && date > max) return true;
377
+ return false;
378
+ };
379
+ exports.isTimeDisabled = isTimeDisabled;
380
+ var FORMAT_TOKEN_REGEX = /yyyy|yy|MM|dd|HH|hh|mm|ss|a/g;
381
+
382
+ // Intl.DateTimeFormat dateStyle presets, for a locale-appropriate long-form
383
+ // display (e.g. moment's 'LL' -> "11 de septiembre de 2026" / "September 11, 2026")
384
+ // without hand-maintaining per-locale strings ourselves. Only usable for
385
+ // display: parseDate can't reliably reverse-parse free-form localized text,
386
+ // so a field using one of these stays calendar/clock-driven rather than typable.
387
+ var DATE_STYLE_KEYWORDS = ['full', 'long', 'medium', 'short'];
388
+ var formatDate = function formatDate(date, format) {
389
+ var locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_LOCALE;
390
+ if (!isValidDate(date) || !format) return '';
391
+ if (DATE_STYLE_KEYWORDS.includes(format)) {
392
+ try {
393
+ return new Intl.DateTimeFormat(locale, {
394
+ dateStyle: format
395
+ }).format(date);
396
+ } catch (e) {
397
+ // fall through to token formatting below
398
+ }
399
+ }
400
+ var hours24 = date.getHours();
401
+ var hours12raw = hours24 % 12;
402
+ var hours12 = hours12raw === 0 ? 12 : hours12raw;
403
+ var replacements = {
404
+ yyyy: date.getFullYear(),
405
+ yy: pad2(date.getFullYear() % 100),
406
+ MM: pad2(date.getMonth() + 1),
407
+ dd: pad2(date.getDate()),
408
+ HH: pad2(hours24),
409
+ hh: pad2(hours12),
410
+ mm: pad2(date.getMinutes()),
411
+ ss: pad2(date.getSeconds()),
412
+ a: getMeridiemText(locale, hours24)
413
+ };
414
+ return format.replace(FORMAT_TOKEN_REGEX, function (token) {
415
+ return String(replacements[token]);
416
+ });
417
+ };
418
+ exports.formatDate = formatDate;
419
+ var escapeRegExp = function escapeRegExp(str) {
420
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
421
+ };
422
+ var BASE_TOKEN_PATTERNS = {
423
+ yyyy: '(\\d{4})',
424
+ yy: '(\\d{2})',
425
+ MM: '(\\d{1,2})',
426
+ dd: '(\\d{1,2})',
427
+ HH: '(\\d{1,2})',
428
+ hh: '(\\d{1,2})',
429
+ mm: '(\\d{1,2})',
430
+ ss: '(\\d{1,2})'
431
+ };
432
+ var parseDate = function parseDate(value, format) {
433
+ var locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_LOCALE;
434
+ if (!value || !format) return null;
435
+ if (DATE_STYLE_KEYWORDS.includes(format)) return null;
436
+ var amText = getMeridiemText(locale, 9);
437
+ var pmText = getMeridiemText(locale, 21);
438
+ var tokenPatterns = _objectSpread(_objectSpread({}, BASE_TOKEN_PATTERNS), {}, {
439
+ // Accept the locale's real AM/PM strings, plus the plain "AM"/"PM"
440
+ // fallback so a formatted value always round-trips through parseDate.
441
+ a: "(".concat(escapeRegExp(amText), "|").concat(escapeRegExp(pmText), "|AM|PM)")
442
+ });
443
+ var tokens = [];
444
+ var regexStr = '';
445
+ var lastIndex = 0;
446
+ var matches = format.matchAll(new RegExp(FORMAT_TOKEN_REGEX.source, 'g'));
447
+ Array.from(matches).forEach(function (match) {
448
+ regexStr += escapeRegExp(format.slice(lastIndex, match.index));
449
+ regexStr += tokenPatterns[match[0]];
450
+ tokens.push(match[0]);
451
+ lastIndex = match.index + match[0].length;
452
+ });
453
+ regexStr += escapeRegExp(format.slice(lastIndex));
454
+ var matched = value.trim().match(new RegExp("^".concat(regexStr, "$"), 'i'));
455
+ if (!matched) return null;
456
+ var parts = {};
457
+ tokens.forEach(function (token, index) {
458
+ parts[token] = matched[index + 1];
459
+ });
460
+ var now = new Date();
461
+ var year = parts.yyyy ? parseInt(parts.yyyy, 10) : parts.yy ? 2000 + parseInt(parts.yy, 10) : now.getFullYear();
462
+ var month = parts.MM ? parseInt(parts.MM, 10) - 1 : 0;
463
+ var day = parts.dd ? parseInt(parts.dd, 10) : 1;
464
+ var hours = 0;
465
+ if (parts.HH !== undefined) {
466
+ hours = parseInt(parts.HH, 10);
467
+ } else if (parts.hh !== undefined) {
468
+ hours = parseInt(parts.hh, 10) % 12;
469
+ if (parts.a && parts.a.toLowerCase() === pmText.toLowerCase()) hours += 12;else if (parts.a && /^p/i.test(parts.a)) hours += 12;
470
+ }
471
+ var minutes = parts.mm ? parseInt(parts.mm, 10) : 0;
472
+ var seconds = parts.ss ? parseInt(parts.ss, 10) : 0;
473
+ if (month < 0 || month > 11 || hours > 23 || minutes > 59 || seconds > 59) return null;
474
+ var result = new Date(year, month, day, hours, minutes, seconds, 0);
475
+ if (result.getFullYear() !== year || result.getMonth() !== month || result.getDate() !== day) return null;
476
+ return result;
477
+ };
478
+ exports.parseDate = parseDate;
@@ -0,0 +1,41 @@
1
+ .cbx-rangeCalendar {
2
+ display: flex;
3
+ align-items: flex-start;
4
+ }
5
+
6
+ .cbx-rangeCalendar-panel {
7
+ padding: var(--spacing16);
8
+ width: 17.5rem;
9
+ max-width: 100%;
10
+ box-sizing: border-box;
11
+ }
12
+
13
+ .cbx-rangeCalendar-panel + .cbx-rangeCalendar-panel {
14
+ border-left: 1px solid var(--gray1);
15
+ }
16
+
17
+ .cbx-rangeCalendar-dayCell {
18
+ position: relative;
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: center;
22
+ height: 2.375rem;
23
+ }
24
+
25
+ .cbx-rangeCalendar-dayCell-inRange {
26
+ background-color: var(--primary10);
27
+ }
28
+
29
+ .cbx-rangeCalendar-dayCell-start {
30
+ background-image: linear-gradient(to right, transparent 50%, var(--primary10) 50%);
31
+ border-radius: 999px 0 0 999px;
32
+ }
33
+
34
+ .cbx-rangeCalendar-dayCell-end {
35
+ background-image: linear-gradient(to left, transparent 50%, var(--primary10) 50%);
36
+ border-radius: 0 999px 999px 0;
37
+ }
38
+
39
+ .cbx-rangeCalendar-day-previewEdge {
40
+ box-shadow: inset 0 0 0 1px var(--primary);
41
+ }