cecomponent 1.0.115 → 1.0.116

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.
@@ -3954,11 +3954,12 @@ const CEDynamicSelectField$1 = forwardRef(({
3954
3954
  selectClassName: f = "",
3955
3955
  containerStyle: u,
3956
3956
  className: y,
3957
- id: d,
3958
- value: g,
3959
- ...m
3960
- }, p) => {
3961
- const S = d || `ce-select-field-${Math.random().toString(36).substr(2, 9)}`, x = () => /* @__PURE__ */ jsxRuntimeExports$1.jsx(
3957
+ isRequiredLabel: d,
3958
+ id: g,
3959
+ value: m,
3960
+ ...p
3961
+ }, S) => {
3962
+ const x = g || `ce-select-field-${Math.random().toString(36).substr(2, 9)}`, _ = () => /* @__PURE__ */ jsxRuntimeExports$1.jsx(
3962
3963
  "svg",
3963
3964
  {
3964
3965
  width: "24",
@@ -3975,45 +3976,48 @@ const CEDynamicSelectField$1 = forwardRef(({
3975
3976
  }
3976
3977
  )
3977
3978
  }
3978
- ), _ = g && t.some((b) => b.value === g), E = a && t.length > 0 && (!g || !_);
3979
+ ), E = m && t.some((T) => T.value === m), b = a && t.length > 0 && (!m || !E);
3979
3980
  return /* @__PURE__ */ jsxRuntimeExports$1.jsxs(
3980
3981
  "div",
3981
3982
  {
3982
3983
  className: `ce-select-field-container ${s ? "full-width" : ""} ${l}`,
3983
3984
  style: u,
3984
3985
  children: [
3985
- e && /* @__PURE__ */ jsxRuntimeExports$1.jsx(
3986
+ e && /* @__PURE__ */ jsxRuntimeExports$1.jsxs(
3986
3987
  "label",
3987
3988
  {
3988
- htmlFor: S,
3989
- className: `ce-select-field-label ${i ? "error" : ""} ${c}`,
3990
- children: e
3989
+ htmlFor: x,
3990
+ className: `ce-select-field-label ${c}`,
3991
+ children: [
3992
+ e,
3993
+ d && /* @__PURE__ */ jsxRuntimeExports$1.jsx("span", { className: "asterisk", children: "*" })
3994
+ ]
3991
3995
  }
3992
3996
  ),
3993
3997
  /* @__PURE__ */ jsxRuntimeExports$1.jsxs("div", { className: "ce-select-field-wrapper", children: [
3994
3998
  /* @__PURE__ */ jsxRuntimeExports$1.jsx(
3995
3999
  "select",
3996
4000
  {
3997
- ref: p,
3998
- id: S,
4001
+ ref: S,
4002
+ id: x,
3999
4003
  className: `ce-select-field-select ${i ? "error" : ""} ${f} ${y || ""}`,
4000
- value: g,
4001
- ...m,
4004
+ value: m,
4005
+ ...p,
4002
4006
  children: t.length === 0 ? /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "", disabled: !0 }) : /* @__PURE__ */ jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [
4003
- E && /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "", disabled: m.required, children: o }),
4004
- t.map((b) => /* @__PURE__ */ jsxRuntimeExports$1.jsx(
4007
+ b && /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "", disabled: p.required, children: o }),
4008
+ t.map((T) => /* @__PURE__ */ jsxRuntimeExports$1.jsx(
4005
4009
  "option",
4006
4010
  {
4007
- value: b.value,
4008
- disabled: b.disabled,
4009
- children: b.label
4011
+ value: T.value,
4012
+ disabled: T.disabled,
4013
+ children: T.label
4010
4014
  },
4011
- b.value
4015
+ T.value
4012
4016
  ))
4013
4017
  ] })
4014
4018
  }
4015
4019
  ),
4016
- /* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { className: "ce-select-field-arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(x, {}) })
4020
+ /* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { className: "ce-select-field-arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(_, {}) })
4017
4021
  ] }),
4018
4022
  i && n && /* @__PURE__ */ jsxRuntimeExports$1.jsx("span", { className: "ce-select-field-error-message", children: n })
4019
4023
  ]
@@ -51018,7 +51022,15 @@ const CEInputBox$1 = ({
51018
51022
  const [o, l] = useState(""), [c, f] = useState(""), [u, y] = useState(!1), [d, g] = useState(""), m = (_) => {
51019
51023
  !_.currentTarget.value && !o && !c && y(!1);
51020
51024
  }, p = (_, E) => {
51021
- _ && E && new Date(E) < new Date(_) ? g("End date must be after or equal to start date") : (g(""), t == null || t({ startDate: _, endDate: E }));
51025
+ if (_ && !E || !_ && E) {
51026
+ g("Both start and end dates must be selected");
51027
+ return;
51028
+ }
51029
+ if (_ && E && new Date(E) < new Date(_)) {
51030
+ g("End date must be after or equal to start date");
51031
+ return;
51032
+ }
51033
+ g(""), t == null || t({ startDate: _, endDate: E });
51022
51034
  }, S = (_) => {
51023
51035
  const E = _.target.value;
51024
51036
  l(E), p(E, c);
@@ -51430,9 +51442,9 @@ const CEInputBox$1 = ({
51430
51442
  Ne(!1), ot(""), He(""), Ze(0);
51431
51443
  return;
51432
51444
  }
51433
- if (st === "dateRange")
51445
+ if (st === "Date Range")
51434
51446
  if (Ke && Ke.startDate && Ke.endDate)
51435
- Ct(ze, void 0, "dateRange");
51447
+ Ct(ze, void 0, "Date Range");
51436
51448
  else {
51437
51449
  Ne(!0);
51438
51450
  return;
@@ -51440,7 +51452,7 @@ const CEInputBox$1 = ({
51440
51452
  else et && et.trim() !== "" && Ct(ze, et, st);
51441
51453
  Ne(!1), ot(""), He(""), Qe(null), Ze(0);
51442
51454
  }, Ct = (te, ae, pe) => {
51443
- if (pe === "dateRange" && Ke && te) {
51455
+ if (pe === "Date Range" && Ke && te) {
51444
51456
  const { startDate: oe, endDate: ye } = Ke;
51445
51457
  if (!oe || !ye) {
51446
51458
  console.warn("Invalid date range:", oe, ye);
@@ -51460,7 +51472,7 @@ const CEInputBox$1 = ({
51460
51472
  ...qe,
51461
51473
  [te]: {
51462
51474
  value: `${oe} - ${ye}`,
51463
- operator: "dateRange"
51475
+ operator: "Date Range"
51464
51476
  }
51465
51477
  }), Ne(!1), Ve(null), Qe(null);
51466
51478
  return;
@@ -52358,18 +52370,18 @@ const CEInputBox$1 = ({
52358
52370
  "aria-label": "Filter operator",
52359
52371
  title: "Select filter operator",
52360
52372
  children: [
52361
- /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "contains", children: "contains" }),
52362
- /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "equals", children: "equals" }),
52363
- /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "startsWith", children: "starts with" }),
52364
- /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "endsWith", children: "ends with" }),
52365
- /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "does not contain", children: "does not contain" }),
52366
- /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "does not equal", children: "does not equal" }),
52367
- /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "dateRange", children: "dateRange" }),
52368
- /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "is any of", children: "is any of" })
52373
+ /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "contains", children: "Contains" }),
52374
+ /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "equals", children: "Equals" }),
52375
+ /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "startsWith", children: "Starts with" }),
52376
+ /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "endsWith", children: "Ends with" }),
52377
+ /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "does not contain", children: "Does not contain" }),
52378
+ /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "does not equal", children: "Does not equal" }),
52379
+ /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "Date Range", children: "Date Range" }),
52380
+ /* @__PURE__ */ jsxRuntimeExports$1.jsx("option", { value: "is any of", children: "Is any of" })
52369
52381
  ]
52370
52382
  }
52371
52383
  ),
52372
- st === "dateRange" && /* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { style: { marginTop: "10px" }, children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(
52384
+ st === "Date Range" && /* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { style: { marginTop: "10px" }, children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(
52373
52385
  CEDateRangePicker,
52374
52386
  {
52375
52387
  mode: "range",
@@ -16,6 +16,7 @@ export interface CESelectFieldProps extends SelectHTMLAttributes<HTMLSelectEleme
16
16
  labelClassName?: string;
17
17
  selectClassName?: string;
18
18
  containerStyle?: React.CSSProperties;
19
+ isRequiredLabel?: boolean;
19
20
  }
20
21
  declare const CEDynamicSelectField: React.ForwardRefExoticComponent<CESelectFieldProps & React.RefAttributes<HTMLSelectElement>>;
21
22
  export default CEDynamicSelectField;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cecomponent",
3
3
  "description": "A React component library for building modern UIs for Cleanearth",
4
- "version": "1.0.115",
4
+ "version": "1.0.116",
5
5
  "main": "dist/ce-component-lib.js",
6
6
  "module": "dist/ce-component-lib.mjs",
7
7
  "types": "dist/index.d.ts",