baaz-custom-components 5.2.8 → 5.2.10

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.d.mts CHANGED
@@ -78,7 +78,7 @@ type Filters = {
78
78
  value: "input" | "date" | "select" | "date-range" | null;
79
79
  options?: {
80
80
  label: string;
81
- value: string;
81
+ value: string | number;
82
82
  }[];
83
83
  key?: string;
84
84
  }[];
package/dist/index.d.ts CHANGED
@@ -78,7 +78,7 @@ type Filters = {
78
78
  value: "input" | "date" | "select" | "date-range" | null;
79
79
  options?: {
80
80
  label: string;
81
- value: string;
81
+ value: string | number;
82
82
  }[];
83
83
  key?: string;
84
84
  }[];
package/dist/index.js CHANGED
@@ -2101,6 +2101,12 @@ var Filters = ({
2101
2101
  const selectedColumns = (0, import_react5.useMemo)(() => {
2102
2102
  return conditions.map((c) => c.column).filter(Boolean);
2103
2103
  }, [conditions]);
2104
+ const toLocalDateTimeString = (epoch) => {
2105
+ const date = new Date(epoch);
2106
+ const offset = date.getTimezoneOffset() * 60 * 1e3;
2107
+ const localDate = new Date(date.getTime() - offset);
2108
+ return localDate.toISOString().slice(0, 16);
2109
+ };
2104
2110
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative", ref: filterRef, children: [
2105
2111
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2106
2112
  "button",
@@ -2239,9 +2245,15 @@ var Filters = ({
2239
2245
  "select",
2240
2246
  {
2241
2247
  value: (_e = condition.value) != null ? _e : "",
2242
- onChange: (e) => updateCondition(condition.id, {
2243
- value: e.target.value
2244
- }),
2248
+ onChange: (e) => {
2249
+ var _a2;
2250
+ const rawValue = e.target.value;
2251
+ const firstOption = (_a2 = selectedOperator.options) == null ? void 0 : _a2[0];
2252
+ const coercedValue = typeof (firstOption == null ? void 0 : firstOption.value) === "number" ? Number(rawValue) : rawValue;
2253
+ updateCondition(condition.id, {
2254
+ value: coercedValue
2255
+ });
2256
+ },
2245
2257
  className: "w-full px-3 py-2 rounded-md bg-input text-sm focus:outline-none",
2246
2258
  children: [
2247
2259
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", disabled: true, children: "Select value" }),
@@ -2267,8 +2279,10 @@ var Filters = ({
2267
2279
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2268
2280
  "input",
2269
2281
  {
2270
- type: "date",
2271
- value: ((_g = condition.value) == null ? void 0 : _g.start) ? new Date(condition.value.start).toISOString().split("T")[0] : "",
2282
+ type: "datetime-local",
2283
+ value: ((_g = condition.value) == null ? void 0 : _g.start) ? toLocalDateTimeString(
2284
+ condition.value.start
2285
+ ) : "",
2272
2286
  onChange: (e) => updateCondition(condition.id, {
2273
2287
  value: __spreadProps(__spreadValues({}, condition.value), {
2274
2288
  start: new Date(e.target.value).getTime()
@@ -2280,8 +2294,10 @@ var Filters = ({
2280
2294
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2281
2295
  "input",
2282
2296
  {
2283
- type: "date",
2284
- value: ((_h = condition.value) == null ? void 0 : _h.end) ? new Date(condition.value.end).toISOString().split("T")[0] : "",
2297
+ type: "datetime-local",
2298
+ value: ((_h = condition.value) == null ? void 0 : _h.end) ? toLocalDateTimeString(
2299
+ condition.value.end
2300
+ ) : "",
2285
2301
  onChange: (e) => updateCondition(condition.id, {
2286
2302
  value: __spreadProps(__spreadValues({}, condition.value), {
2287
2303
  end: new Date(e.target.value).getTime()
package/dist/index.mjs CHANGED
@@ -2070,6 +2070,12 @@ var Filters = ({
2070
2070
  const selectedColumns = useMemo3(() => {
2071
2071
  return conditions.map((c) => c.column).filter(Boolean);
2072
2072
  }, [conditions]);
2073
+ const toLocalDateTimeString = (epoch) => {
2074
+ const date = new Date(epoch);
2075
+ const offset = date.getTimezoneOffset() * 60 * 1e3;
2076
+ const localDate = new Date(date.getTime() - offset);
2077
+ return localDate.toISOString().slice(0, 16);
2078
+ };
2073
2079
  return /* @__PURE__ */ jsxs17("div", { className: "relative", ref: filterRef, children: [
2074
2080
  /* @__PURE__ */ jsxs17(
2075
2081
  "button",
@@ -2208,9 +2214,15 @@ var Filters = ({
2208
2214
  "select",
2209
2215
  {
2210
2216
  value: (_e = condition.value) != null ? _e : "",
2211
- onChange: (e) => updateCondition(condition.id, {
2212
- value: e.target.value
2213
- }),
2217
+ onChange: (e) => {
2218
+ var _a2;
2219
+ const rawValue = e.target.value;
2220
+ const firstOption = (_a2 = selectedOperator.options) == null ? void 0 : _a2[0];
2221
+ const coercedValue = typeof (firstOption == null ? void 0 : firstOption.value) === "number" ? Number(rawValue) : rawValue;
2222
+ updateCondition(condition.id, {
2223
+ value: coercedValue
2224
+ });
2225
+ },
2214
2226
  className: "w-full px-3 py-2 rounded-md bg-input text-sm focus:outline-none",
2215
2227
  children: [
2216
2228
  /* @__PURE__ */ jsx23("option", { value: "", disabled: true, children: "Select value" }),
@@ -2236,8 +2248,10 @@ var Filters = ({
2236
2248
  /* @__PURE__ */ jsx23(
2237
2249
  "input",
2238
2250
  {
2239
- type: "date",
2240
- value: ((_g = condition.value) == null ? void 0 : _g.start) ? new Date(condition.value.start).toISOString().split("T")[0] : "",
2251
+ type: "datetime-local",
2252
+ value: ((_g = condition.value) == null ? void 0 : _g.start) ? toLocalDateTimeString(
2253
+ condition.value.start
2254
+ ) : "",
2241
2255
  onChange: (e) => updateCondition(condition.id, {
2242
2256
  value: __spreadProps(__spreadValues({}, condition.value), {
2243
2257
  start: new Date(e.target.value).getTime()
@@ -2249,8 +2263,10 @@ var Filters = ({
2249
2263
  /* @__PURE__ */ jsx23(
2250
2264
  "input",
2251
2265
  {
2252
- type: "date",
2253
- value: ((_h = condition.value) == null ? void 0 : _h.end) ? new Date(condition.value.end).toISOString().split("T")[0] : "",
2266
+ type: "datetime-local",
2267
+ value: ((_h = condition.value) == null ? void 0 : _h.end) ? toLocalDateTimeString(
2268
+ condition.value.end
2269
+ ) : "",
2254
2270
  onChange: (e) => updateCondition(condition.id, {
2255
2271
  value: __spreadProps(__spreadValues({}, condition.value), {
2256
2272
  end: new Date(e.target.value).getTime()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baaz-custom-components",
3
- "version": "5.2.8",
3
+ "version": "5.2.10",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",