trotl-filter 1.0.6 → 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
@@ -7309,8 +7309,21 @@ const DebounceSelect = ({
7309
7309
  isMulti = false,
7310
7310
  pushUrlParamObj = false,
7311
7311
  addItem = undefined,
7312
- fetchAll = true
7312
+ fetchAll = true,
7313
+ t
7313
7314
  }) => {
7315
+ let translate;
7316
+ if (t) {
7317
+ translate = t;
7318
+ } else {
7319
+ translate = key => {
7320
+ const translations = {
7321
+ add: "Add",
7322
+ cancel: "Cancel"
7323
+ };
7324
+ return translations[key] || key;
7325
+ };
7326
+ }
7314
7327
  const [input, setInput] = useState("");
7315
7328
  const [options, setOptions] = useState([]);
7316
7329
  const [loading, setLoading] = useState(false);
@@ -7537,21 +7550,21 @@ const DebounceSelect = ({
7537
7550
  key: value,
7538
7551
  className: "basic-input-dropdown-item",
7539
7552
  onMouseDown: () => handleSelect(value, label)
7540
- }, label)), input.trim() && !inputExists && typeof addItem === 'function' && /*#__PURE__*/React__default.createElement("div", {
7553
+ }, translate(label))), input.trim() && !inputExists && typeof addItem === 'function' && /*#__PURE__*/React__default.createElement("div", {
7541
7554
  className: "basic-input-dropdown-item",
7542
7555
  style: {
7543
7556
  color: '#1677ff',
7544
7557
  fontWeight: 500
7545
7558
  },
7546
7559
  onMouseDown: handleAddNew
7547
- }, "+ Add \"", input.trim(), "\"")) : input.trim() && !loading && typeof addItem === 'function' ? /*#__PURE__*/React__default.createElement("div", {
7560
+ }, "+ ", translate("add"), " \"", input.trim(), "\"")) : input.trim() && !loading && typeof addItem === 'function' ? /*#__PURE__*/React__default.createElement("div", {
7548
7561
  className: "basic-input-dropdown-item",
7549
7562
  style: {
7550
7563
  color: '#1677ff',
7551
7564
  fontWeight: 500
7552
7565
  },
7553
7566
  onMouseDown: handleAddNew
7554
- }, "+ Add \"", input.trim(), "\"") : /*#__PURE__*/React__default.createElement("div", {
7567
+ }, "+ ", translate("add"), " \"", input.trim(), "\"") : /*#__PURE__*/React__default.createElement("div", {
7555
7568
  className: "no-results-dropdown-item"
7556
7569
  }, "No results")));
7557
7570
  };
@@ -8788,6 +8801,7 @@ function DateTimeInput({
8788
8801
  className = "",
8789
8802
  style = {},
8790
8803
  predefinedRanges = ["today", "yesterday"],
8804
+ startWith = "sunday",
8791
8805
  ...rest
8792
8806
  }) {
8793
8807
  const paramKey = pushUrlParamObj || null;
@@ -8986,8 +9000,12 @@ function DateTimeInput({
8986
9000
  // Build calendar days (6 weeks grid)
8987
9001
  const buildDays = () => {
8988
9002
  const startOfMonth = new Date(monthCursor.getFullYear(), monthCursor.getMonth(), 1);
8989
- const dayOfWeek = startOfMonth.getDay(); // 0 Sun ... 6 Sat
8990
- // 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
8991
9009
  const firstGridDate = new Date(startOfMonth);
8992
9010
  firstGridDate.setDate(startOfMonth.getDate() - dayOfWeek);
8993
9011
  const days = [];
@@ -9224,7 +9242,7 @@ function DateTimeInput({
9224
9242
  marginBottom: 4,
9225
9243
  opacity: 0.8
9226
9244
  }
9227
- }, ['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", {
9228
9246
  key: d,
9229
9247
  style: {
9230
9248
  textAlign: 'center'
@@ -9336,6 +9354,7 @@ DateTimeInput.propTypes = {
9336
9354
  * onChange: (startDate, endDate) => void
9337
9355
  * time: boolean - if true, show time selectors
9338
9356
  * timeStart, timeEnd: default times for start/end
9357
+ * startWith: "sunday" | "monday" - first day of week
9339
9358
  */
9340
9359
  function CalendarRangePicker({
9341
9360
  startDate,
@@ -9343,7 +9362,8 @@ function CalendarRangePicker({
9343
9362
  onChange,
9344
9363
  time = false,
9345
9364
  timeStart = "00:00",
9346
- timeEnd = "23:59"
9365
+ timeEnd = "23:59",
9366
+ startWith = "sunday"
9347
9367
  }) {
9348
9368
  // Current view months (show 2 months)
9349
9369
  const [leftMonth, setLeftMonth] = useState(() => {
@@ -9421,7 +9441,11 @@ function CalendarRangePicker({
9421
9441
  const monthIdx = month.getMonth();
9422
9442
  const firstDay = new Date(year, monthIdx, 1);
9423
9443
  const lastDay = new Date(year, monthIdx + 1, 0);
9424
- 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
+ }
9425
9449
  const daysInMonth = lastDay.getDate();
9426
9450
  const days = [];
9427
9451
  // Padding days from previous month
@@ -9468,7 +9492,7 @@ function CalendarRangePicker({
9468
9492
  gridTemplateColumns: "repeat(7, 1fr)",
9469
9493
  gap: 2
9470
9494
  }
9471
- }, ["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", {
9472
9496
  key: day,
9473
9497
  style: {
9474
9498
  textAlign: "center",
@@ -9572,7 +9596,8 @@ CalendarRangePicker.propTypes = {
9572
9596
  onChange: PropTypes.func.isRequired,
9573
9597
  time: PropTypes.bool,
9574
9598
  timeStart: PropTypes.string,
9575
- timeEnd: PropTypes.string
9599
+ timeEnd: PropTypes.string,
9600
+ startWith: PropTypes.oneOf(["sunday", "monday"])
9576
9601
  };
9577
9602
 
9578
9603
  /**
@@ -9772,6 +9797,7 @@ function RangePicker({
9772
9797
  min,
9773
9798
  max,
9774
9799
  predefinedRanges = PREDEFINED_RANGES,
9800
+ startWith = "sunday",
9775
9801
  ...rest
9776
9802
  }) {
9777
9803
  const paramKey = pushUrlParamObj || null;
@@ -10105,7 +10131,8 @@ function RangePicker({
10105
10131
  },
10106
10132
  time: time,
10107
10133
  timeStart: timeStart,
10108
- timeEnd: timeEnd
10134
+ timeEnd: timeEnd,
10135
+ startWith: startWith
10109
10136
  }), processedRanges && processedRanges.length > 0 && /*#__PURE__*/React__default.createElement("div", {
10110
10137
  style: {
10111
10138
  marginTop: 12,
@@ -10193,6 +10220,7 @@ RangePicker.propTypes = {
10193
10220
  style: PropTypes.object,
10194
10221
  min: PropTypes.string,
10195
10222
  max: PropTypes.string,
10223
+ startWith: PropTypes.oneOf(["sunday", "monday"]),
10196
10224
  predefinedRanges: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string,
10197
10225
  // e.g., "today", "yesterday", "lastweek"
10198
10226
  PropTypes.number,