@apexcura/ui-components 0.0.11-Beta102 → 0.0.11-Beta104

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
@@ -1,6 +1,7 @@
1
1
  import React$1 from 'react';
2
2
 
3
3
  type ElementType = {
4
+ className: string | undefined;
4
5
  placeholder?: string;
5
6
  addonBefore?: React.ReactNode;
6
7
  defaultValue?: string;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import React$1 from 'react';
2
2
 
3
3
  type ElementType = {
4
+ className: string | undefined;
4
5
  placeholder?: string;
5
6
  addonBefore?: React.ReactNode;
6
7
  defaultValue?: string;
package/dist/index.js CHANGED
@@ -189,26 +189,33 @@ var import_react6 = __toESM(require("react"));
189
189
  var import_antd6 = require("antd");
190
190
  var RadioElement = (props) => {
191
191
  const [isDisabled, setIsDisabled] = (0, import_react6.useState)(props.disabled);
192
+ const [selectedValue, setSelectedValue] = (0, import_react6.useState)(props.value);
192
193
  let optionType;
193
194
  if (props.optionType === "button") {
194
195
  optionType = props.optionType;
195
196
  }
196
197
  const handleChange = (e) => {
198
+ const selectedVal = e.target.value;
199
+ const selectedOptions = [{ id: selectedVal, value: selectedVal }];
200
+ setSelectedValue(selectedVal);
201
+ setIsDisabled(true);
197
202
  if (props.onChange) {
198
- const selectedVal = e.target.value;
199
- const selectedOptions = [{ id: selectedVal, value: selectedVal }];
200
203
  props.onChange(selectedOptions);
201
- setIsDisabled(true);
202
204
  }
203
205
  };
206
+ const radioOptions = props.options && props.options.map((option) => ({
207
+ ...option,
208
+ className: selectedValue === option.value ? option.selectedClassName : option.className,
209
+ disabled: isDisabled
210
+ }));
204
211
  return /* @__PURE__ */ import_react6.default.createElement(
205
212
  import_antd6.Radio.Group,
206
213
  {
207
- options: props.options,
214
+ options: radioOptions,
208
215
  onChange: handleChange,
209
216
  disabled: isDisabled,
210
217
  optionType,
211
- className: props.classNames
218
+ className: props.className ? props.className : ""
212
219
  }
213
220
  );
214
221
  };
@@ -451,9 +458,9 @@ var AddMoreTable = (props) => {
451
458
  return null;
452
459
  const { element: type, label } = element;
453
460
  if (type === "single-select") {
454
- return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "" });
461
+ return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0 });
455
462
  } else if (type === "textarea") {
456
- return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "" });
463
+ return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0 });
457
464
  } else {
458
465
  return null;
459
466
  }
package/dist/index.mjs CHANGED
@@ -142,26 +142,33 @@ import React6, { useState as useState2 } from "react";
142
142
  import { Radio } from "antd";
143
143
  var RadioElement = (props) => {
144
144
  const [isDisabled, setIsDisabled] = useState2(props.disabled);
145
+ const [selectedValue, setSelectedValue] = useState2(props.value);
145
146
  let optionType;
146
147
  if (props.optionType === "button") {
147
148
  optionType = props.optionType;
148
149
  }
149
150
  const handleChange = (e) => {
151
+ const selectedVal = e.target.value;
152
+ const selectedOptions = [{ id: selectedVal, value: selectedVal }];
153
+ setSelectedValue(selectedVal);
154
+ setIsDisabled(true);
150
155
  if (props.onChange) {
151
- const selectedVal = e.target.value;
152
- const selectedOptions = [{ id: selectedVal, value: selectedVal }];
153
156
  props.onChange(selectedOptions);
154
- setIsDisabled(true);
155
157
  }
156
158
  };
159
+ const radioOptions = props.options && props.options.map((option) => ({
160
+ ...option,
161
+ className: selectedValue === option.value ? option.selectedClassName : option.className,
162
+ disabled: isDisabled
163
+ }));
157
164
  return /* @__PURE__ */ React6.createElement(
158
165
  Radio.Group,
159
166
  {
160
- options: props.options,
167
+ options: radioOptions,
161
168
  onChange: handleChange,
162
169
  disabled: isDisabled,
163
170
  optionType,
164
- className: props.classNames
171
+ className: props.className ? props.className : ""
165
172
  }
166
173
  );
167
174
  };
@@ -404,9 +411,9 @@ var AddMoreTable = (props) => {
404
411
  return null;
405
412
  const { element: type, label } = element;
406
413
  if (type === "single-select") {
407
- return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "" });
414
+ return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0 });
408
415
  } else if (type === "textarea") {
409
- return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "" });
416
+ return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0 });
410
417
  } else {
411
418
  return null;
412
419
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta102",
3
+ "version": "0.0.11-Beta104",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",