trotl-filter 1.0.7 → 1.0.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/index.esm.js CHANGED
@@ -8801,6 +8801,7 @@ function DateTimeInput({
8801
8801
  className = "",
8802
8802
  style = {},
8803
8803
  predefinedRanges = ["today", "yesterday"],
8804
+ startWith = "sunday",
8804
8805
  ...rest
8805
8806
  }) {
8806
8807
  const paramKey = pushUrlParamObj || null;
@@ -8999,8 +9000,12 @@ function DateTimeInput({
8999
9000
  // Build calendar days (6 weeks grid)
9000
9001
  const buildDays = () => {
9001
9002
  const startOfMonth = new Date(monthCursor.getFullYear(), monthCursor.getMonth(), 1);
9002
- const dayOfWeek = startOfMonth.getDay(); // 0 Sun ... 6 Sat
9003
- // We start at Sunday of the week containing the 1st
9003
+ let dayOfWeek = startOfMonth.getDay(); // 0 Sun ... 6 Sat
9004
+ // Adjust for Monday start
9005
+ if (startWith === "monday") {
9006
+ dayOfWeek = dayOfWeek === 0 ? 6 : dayOfWeek - 1;
9007
+ }
9008
+ // We start at the first day of the week containing the 1st
9004
9009
  const firstGridDate = new Date(startOfMonth);
9005
9010
  firstGridDate.setDate(startOfMonth.getDate() - dayOfWeek);
9006
9011
  const days = [];
@@ -9237,7 +9242,7 @@ function DateTimeInput({
9237
9242
  marginBottom: 4,
9238
9243
  opacity: 0.8
9239
9244
  }
9240
- }, ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'].map(d => /*#__PURE__*/React__default.createElement("div", {
9245
+ }, (startWith === "monday" ? ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'] : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']).map(d => /*#__PURE__*/React__default.createElement("div", {
9241
9246
  key: d,
9242
9247
  style: {
9243
9248
  textAlign: 'center'
@@ -9349,6 +9354,7 @@ DateTimeInput.propTypes = {
9349
9354
  * onChange: (startDate, endDate) => void
9350
9355
  * time: boolean - if true, show time selectors
9351
9356
  * timeStart, timeEnd: default times for start/end
9357
+ * startWith: "sunday" | "monday" - first day of week
9352
9358
  */
9353
9359
  function CalendarRangePicker({
9354
9360
  startDate,
@@ -9356,7 +9362,8 @@ function CalendarRangePicker({
9356
9362
  onChange,
9357
9363
  time = false,
9358
9364
  timeStart = "00:00",
9359
- timeEnd = "23:59"
9365
+ timeEnd = "23:59",
9366
+ startWith = "sunday"
9360
9367
  }) {
9361
9368
  // Current view months (show 2 months)
9362
9369
  const [leftMonth, setLeftMonth] = useState(() => {
@@ -9434,7 +9441,11 @@ function CalendarRangePicker({
9434
9441
  const monthIdx = month.getMonth();
9435
9442
  const firstDay = new Date(year, monthIdx, 1);
9436
9443
  const lastDay = new Date(year, monthIdx + 1, 0);
9437
- const startWeekday = firstDay.getDay(); // 0 = Sunday
9444
+ let startWeekday = firstDay.getDay(); // 0 = Sunday
9445
+ // Adjust for Monday start
9446
+ if (startWith === "monday") {
9447
+ startWeekday = startWeekday === 0 ? 6 : startWeekday - 1;
9448
+ }
9438
9449
  const daysInMonth = lastDay.getDate();
9439
9450
  const days = [];
9440
9451
  // Padding days from previous month
@@ -9481,7 +9492,7 @@ function CalendarRangePicker({
9481
9492
  gridTemplateColumns: "repeat(7, 1fr)",
9482
9493
  gap: 2
9483
9494
  }
9484
- }, ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(day => /*#__PURE__*/React__default.createElement("div", {
9495
+ }, (startWith === "monday" ? ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"] : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]).map(day => /*#__PURE__*/React__default.createElement("div", {
9485
9496
  key: day,
9486
9497
  style: {
9487
9498
  textAlign: "center",
@@ -9585,7 +9596,8 @@ CalendarRangePicker.propTypes = {
9585
9596
  onChange: PropTypes.func.isRequired,
9586
9597
  time: PropTypes.bool,
9587
9598
  timeStart: PropTypes.string,
9588
- timeEnd: PropTypes.string
9599
+ timeEnd: PropTypes.string,
9600
+ startWith: PropTypes.oneOf(["sunday", "monday"])
9589
9601
  };
9590
9602
 
9591
9603
  /**
@@ -9785,6 +9797,7 @@ function RangePicker({
9785
9797
  min,
9786
9798
  max,
9787
9799
  predefinedRanges = PREDEFINED_RANGES,
9800
+ startWith = "sunday",
9788
9801
  ...rest
9789
9802
  }) {
9790
9803
  const paramKey = pushUrlParamObj || null;
@@ -10118,7 +10131,8 @@ function RangePicker({
10118
10131
  },
10119
10132
  time: time,
10120
10133
  timeStart: timeStart,
10121
- timeEnd: timeEnd
10134
+ timeEnd: timeEnd,
10135
+ startWith: startWith
10122
10136
  }), processedRanges && processedRanges.length > 0 && /*#__PURE__*/React__default.createElement("div", {
10123
10137
  style: {
10124
10138
  marginTop: 12,
@@ -10206,6 +10220,7 @@ RangePicker.propTypes = {
10206
10220
  style: PropTypes.object,
10207
10221
  min: PropTypes.string,
10208
10222
  max: PropTypes.string,
10223
+ startWith: PropTypes.oneOf(["sunday", "monday"]),
10209
10224
  predefinedRanges: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string,
10210
10225
  // e.g., "today", "yesterday", "lastweek"
10211
10226
  PropTypes.number,