cecomponent 1.0.134 → 1.0.136

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.
@@ -4092,7 +4092,94 @@ const CEDynamicSelectField = forwardRef(
4092
4092
  }
4093
4093
  );
4094
4094
  CEDynamicSelectField.displayName = "CESelectField";
4095
- const CEDynamicTextField = forwardRef(({
4095
+ const CEInputBox = ({
4096
+ value: e,
4097
+ onChange: t,
4098
+ placeholder: i = "",
4099
+ type: n = "text",
4100
+ maxLength: s,
4101
+ minLength: a,
4102
+ required: o = !1,
4103
+ customValidator: l,
4104
+ errorMessage: c = "Invalid input",
4105
+ showError: f = !0,
4106
+ label: u,
4107
+ labelSuffix: x,
4108
+ disabled: d = !1,
4109
+ style: y = {},
4110
+ size: m = "medium",
4111
+ onFocus: p,
4112
+ onBlur: E,
4113
+ autoFocus: g = !1,
4114
+ alwaysShowLabel: S,
4115
+ id: _,
4116
+ name: T,
4117
+ onChangeMeta: b
4118
+ }) => {
4119
+ const [C, R] = useState(!1), F = (te) => {
4120
+ R(!0), p == null || p(te);
4121
+ }, M = (te) => {
4122
+ R(!1), E == null || E(te);
4123
+ }, A = (te) => {
4124
+ const J = te.target.value;
4125
+ n === "number" && !/^\d*\.?\d{0,2}$/.test(J) || n === "alphanumeric" && !/^[a-zA-Z0-9]*$/.test(J) || (t(J), b == null || b(J, { id: _, name: T }));
4126
+ }, V = getSizeStyle$1(m || "medium"), U = f && o && !e, Y = {
4127
+ fontSize: V.fontSize,
4128
+ padding: V.padding,
4129
+ ...y
4130
+ // if you have a style prop
4131
+ };
4132
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
4133
+ "div",
4134
+ {
4135
+ className: `validated-input-wrapper ${C ? "focused" : ""} ${U ? "error" : ""}`,
4136
+ children: [
4137
+ u && /* @__PURE__ */ jsxRuntimeExports.jsxs(
4138
+ "label",
4139
+ {
4140
+ className: `validated-input-label ${S || e || C ? "shrink" : ""}`,
4141
+ children: [
4142
+ u,
4143
+ x && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { marginLeft: 4 }, children: x })
4144
+ ]
4145
+ }
4146
+ ),
4147
+ n === "textarea" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
4148
+ "textarea",
4149
+ {
4150
+ value: e,
4151
+ onChange: A,
4152
+ onFocus: F,
4153
+ onBlur: M,
4154
+ placeholder: i || " ",
4155
+ id: _,
4156
+ name: T,
4157
+ className: `validated-input-field ${U ? "input-error" : ""}`,
4158
+ disabled: d,
4159
+ style: Y
4160
+ }
4161
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
4162
+ "input",
4163
+ {
4164
+ type: n,
4165
+ value: e,
4166
+ onChange: A,
4167
+ onFocus: F,
4168
+ onBlur: M,
4169
+ placeholder: i || " ",
4170
+ id: _,
4171
+ name: T,
4172
+ className: `validated-input-field ${U ? "input-error" : ""}`,
4173
+ disabled: d,
4174
+ style: Y,
4175
+ autoFocus: g
4176
+ }
4177
+ ),
4178
+ f && !e && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "validated-input-error", children: c })
4179
+ ]
4180
+ }
4181
+ );
4182
+ }, CEDynamicTextField = forwardRef(({
4096
4183
  label: e,
4097
4184
  error: t = !1,
4098
4185
  errorMessage: i,
@@ -4104,9 +4191,13 @@ const CEDynamicTextField = forwardRef(({
4104
4191
  className: c,
4105
4192
  id: f,
4106
4193
  name: u,
4107
- ...x
4108
- }, d) => {
4109
- const y = f || `ce-text-field-${Math.random().toString(36).substr(2, 9)}`;
4194
+ multiline: x = !1,
4195
+ rows: d,
4196
+ minHeight: y,
4197
+ width: m,
4198
+ ...p
4199
+ }, E) => {
4200
+ const g = f || `ce-text-field-${Math.random().toString(36).substr(2, 9)}`;
4110
4201
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
4111
4202
  "div",
4112
4203
  {
@@ -4116,20 +4207,42 @@ const CEDynamicTextField = forwardRef(({
4116
4207
  e && /* @__PURE__ */ jsxRuntimeExports.jsx(
4117
4208
  "label",
4118
4209
  {
4119
- htmlFor: y,
4210
+ htmlFor: g,
4120
4211
  className: `ce-text-field-label ${t ? "error" : ""} ${a}`,
4121
4212
  children: e
4122
4213
  }
4123
4214
  ),
4124
- /* @__PURE__ */ jsxRuntimeExports.jsx(
4215
+ x ? /* @__PURE__ */ jsxRuntimeExports.jsx(
4216
+ CEInputBox,
4217
+ {
4218
+ type: "textarea",
4219
+ value: p.value,
4220
+ onChange: (S) => {
4221
+ p.onChange && p.onChange({ target: { value: S, name: u } });
4222
+ },
4223
+ id: g,
4224
+ name: u,
4225
+ placeholder: p.placeholder,
4226
+ errorMessage: i,
4227
+ showError: t,
4228
+ label: e,
4229
+ required: p.required,
4230
+ alwaysShowLabel: !0,
4231
+ style: {
4232
+ minHeight: y || "100px",
4233
+ width: m || "100%"
4234
+ // ✅ Use the new width prop
4235
+ }
4236
+ }
4237
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
4125
4238
  "input",
4126
4239
  {
4127
- ref: d,
4240
+ ref: E,
4128
4241
  type: "text",
4129
- id: y,
4242
+ id: g,
4130
4243
  name: u,
4131
4244
  className: `ce-text-field-input ${t ? "error" : ""} ${o} ${c || ""}`,
4132
- ...x
4245
+ ...p
4133
4246
  }
4134
4247
  ),
4135
4248
  t && i && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ce-text-field-error-message", children: i })
@@ -39671,93 +39784,6 @@ const ExportIcon = "data:image/svg+xml,%3csvg%20width='24'%20height='25'%20viewB
39671
39784
  return t;
39672
39785
  }
39673
39786
  return e;
39674
- }, CEInputBox = ({
39675
- value: e,
39676
- onChange: t,
39677
- placeholder: i = "",
39678
- type: n = "text",
39679
- maxLength: s,
39680
- minLength: a,
39681
- required: o = !1,
39682
- customValidator: l,
39683
- errorMessage: c = "Invalid input",
39684
- showError: f = !0,
39685
- label: u,
39686
- labelSuffix: x,
39687
- disabled: d = !1,
39688
- style: y = {},
39689
- size: m = "medium",
39690
- onFocus: p,
39691
- onBlur: E,
39692
- autoFocus: g = !1,
39693
- alwaysShowLabel: S,
39694
- id: _,
39695
- name: T,
39696
- onChangeMeta: b
39697
- }) => {
39698
- const [C, R] = useState(!1), F = (te) => {
39699
- R(!0), p == null || p(te);
39700
- }, M = (te) => {
39701
- R(!1), E == null || E(te);
39702
- }, A = (te) => {
39703
- const J = te.target.value;
39704
- n === "number" && !/^\d*\.?\d{0,2}$/.test(J) || n === "alphanumeric" && !/^[a-zA-Z0-9]*$/.test(J) || (t(J), b == null || b(J, { id: _, name: T }));
39705
- }, V = getSizeStyle$1(m || "medium"), U = f && o && !e, Y = {
39706
- fontSize: V.fontSize,
39707
- padding: V.padding,
39708
- ...y
39709
- // if you have a style prop
39710
- };
39711
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
39712
- "div",
39713
- {
39714
- className: `validated-input-wrapper ${C ? "focused" : ""} ${U ? "error" : ""}`,
39715
- children: [
39716
- u && /* @__PURE__ */ jsxRuntimeExports.jsxs(
39717
- "label",
39718
- {
39719
- className: `validated-input-label ${S || e || C ? "shrink" : ""}`,
39720
- children: [
39721
- u,
39722
- x && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { marginLeft: 4 }, children: x })
39723
- ]
39724
- }
39725
- ),
39726
- n === "textarea" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
39727
- "textarea",
39728
- {
39729
- value: e,
39730
- onChange: A,
39731
- onFocus: F,
39732
- onBlur: M,
39733
- placeholder: i || " ",
39734
- id: _,
39735
- name: T,
39736
- className: `validated-input-field ${U ? "input-error" : ""}`,
39737
- disabled: d,
39738
- style: Y
39739
- }
39740
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
39741
- "input",
39742
- {
39743
- type: n,
39744
- value: e,
39745
- onChange: A,
39746
- onFocus: F,
39747
- onBlur: M,
39748
- placeholder: i || " ",
39749
- id: _,
39750
- name: T,
39751
- className: `validated-input-field ${U ? "input-error" : ""}`,
39752
- disabled: d,
39753
- style: Y,
39754
- autoFocus: g
39755
- }
39756
- ),
39757
- f && !e && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "validated-input-error", children: c })
39758
- ]
39759
- }
39760
- );
39761
39787
  }, DatePickerCell = ({ row: e, colId: t }) => {
39762
39788
  var n;
39763
39789
  const i = (s) => {
@@ -43833,22 +43859,24 @@ const CEAdvancedMultiSelectDropdown = ({
43833
43859
  id: o
43834
43860
  }) => {
43835
43861
  const [l, c] = useState(!1), [f, u] = useState(!1), [x, d] = useState(""), y = useRef(null), m = useRef(null), p = t.filter(
43836
- (_) => _.label.toLowerCase().includes(x.toLowerCase())
43837
- ), E = (_) => {
43862
+ (T) => T.label.toLowerCase().includes(x.toLowerCase())
43863
+ ), E = (T) => {
43838
43864
  if (s) {
43839
- const T = i.includes(_.value);
43865
+ const b = i.includes(T.value);
43840
43866
  n(
43841
- T ? i.filter((b) => b !== _.value) : [...i, _.value]
43867
+ b ? i.filter((C) => C !== T.value) : [...i, T.value]
43842
43868
  ), d("");
43843
43869
  } else
43844
- n([_.value]), d(_.label), c(!1);
43845
- }, g = (_) => {
43846
- m.current && !m.current.contains(_.target) && (c(!1), u(!1));
43870
+ n([T.value]), d(T.label), c(!1);
43871
+ }, g = (T) => {
43872
+ m.current && !m.current.contains(T.target) && (c(!1), u(!1));
43847
43873
  };
43848
43874
  useEffect(() => (document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g)), []);
43849
- const S = (_) => {
43850
- var T;
43851
- return ((T = t.find((b) => b.value === _)) == null ? void 0 : T.label) || _;
43875
+ const S = (T) => {
43876
+ var b;
43877
+ return ((b = t.find((C) => C.value === T)) == null ? void 0 : b.label) || T;
43878
+ }, _ = (T) => {
43879
+ T.stopPropagation(), d(""), n([]);
43852
43880
  };
43853
43881
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
43854
43882
  "div",
@@ -43866,18 +43894,18 @@ const CEAdvancedMultiSelectDropdown = ({
43866
43894
  children: [
43867
43895
  /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "autocomplete-label", children: e }),
43868
43896
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "input-area", children: [
43869
- s && i.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "selected-values", children: i.map((_) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "selected-tag", children: [
43870
- S(_),
43897
+ s && i.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "selected-values", children: i.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "selected-tag", children: [
43898
+ S(T),
43871
43899
  /* @__PURE__ */ jsxRuntimeExports.jsx(
43872
43900
  "button",
43873
43901
  {
43874
- onClick: (T) => {
43875
- T.stopPropagation(), n(i.filter((b) => b !== _));
43902
+ onClick: (b) => {
43903
+ b.stopPropagation(), n(i.filter((C) => C !== T));
43876
43904
  },
43877
43905
  children: "×"
43878
43906
  }
43879
43907
  )
43880
- ] }, _)) }),
43908
+ ] }, T)) }),
43881
43909
  /* @__PURE__ */ jsxRuntimeExports.jsx(
43882
43910
  "input",
43883
43911
  {
@@ -43885,17 +43913,20 @@ const CEAdvancedMultiSelectDropdown = ({
43885
43913
  type: "text",
43886
43914
  className: "autocomplete-input",
43887
43915
  value: x,
43888
- onChange: (_) => d(_.target.value),
43916
+ onChange: (T) => d(T.target.value),
43889
43917
  onFocus: () => {
43890
43918
  u(!0), c(!0);
43891
43919
  }
43892
43920
  }
43893
43921
  ),
43922
+ i.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "clear-icon", onClick: _, title: "Clear", children: "×" }),
43894
43923
  /* @__PURE__ */ jsxRuntimeExports.jsx(
43895
43924
  "span",
43896
43925
  {
43897
43926
  className: "dropdown-toggle-icon",
43898
- onClick: () => c((_) => !_),
43927
+ onClick: (T) => {
43928
+ T.stopPropagation(), c((b) => !b);
43929
+ },
43899
43930
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M7 10l5 5 5-5H7z", fill: "gray" }) })
43900
43931
  }
43901
43932
  )
@@ -43911,25 +43942,25 @@ const CEAdvancedMultiSelectDropdown = ({
43911
43942
  type: "checkbox",
43912
43943
  checked: i.length === t.length,
43913
43944
  onChange: () => {
43914
- const _ = i.length === t.length;
43915
- n(_ ? [] : t.map((T) => T.value));
43945
+ const T = i.length === t.length;
43946
+ n(T ? [] : t.map((b) => b.value));
43916
43947
  }
43917
43948
  }
43918
43949
  ),
43919
43950
  "Select All"
43920
43951
  ] }) }),
43921
- p.map((_) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", { onClick: () => E(_), children: s && a ? /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { children: [
43952
+ p.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", { onClick: () => E(T), children: s && a ? /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { children: [
43922
43953
  /* @__PURE__ */ jsxRuntimeExports.jsx(
43923
43954
  "input",
43924
43955
  {
43925
43956
  type: "checkbox",
43926
- checked: i.includes(_.value),
43927
- onChange: () => E(_),
43928
- onClick: (T) => T.stopPropagation()
43957
+ checked: i.includes(T.value),
43958
+ onChange: () => E(T),
43959
+ onClick: (b) => b.stopPropagation()
43929
43960
  }
43930
43961
  ),
43931
- _.label
43932
- ] }) : _.label }, _.value))
43962
+ T.label
43963
+ ] }) : T.label }, T.value))
43933
43964
  ] })
43934
43965
  ]
43935
43966
  }
@@ -10,6 +10,10 @@ export interface CETextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElem
10
10
  containerStyle?: React.CSSProperties;
11
11
  id?: string;
12
12
  name?: string;
13
+ multiline?: boolean;
14
+ rows?: number;
15
+ minHeight?: number | string;
16
+ width?: number | string;
13
17
  }
14
18
  declare const CEDynamicTextField: React.ForwardRefExoticComponent<CETextFieldProps & React.RefAttributes<HTMLInputElement>>;
15
19
  export default CEDynamicTextField;
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.134",
4
+ "version": "1.0.136",
5
5
  "main": "dist/ce-component-lib.js",
6
6
  "module": "dist/ce-component-lib.mjs",
7
7
  "types": "dist/index.d.ts",