cecomponent 1.0.134 → 1.0.135

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) => {
@@ -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.135",
5
5
  "main": "dist/ce-component-lib.js",
6
6
  "module": "dist/ce-component-lib.mjs",
7
7
  "types": "dist/index.d.ts",