@apexcura/ui-components 0.0.8-Beta0 → 0.0.8-Beta10

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ApexCura
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.mts CHANGED
@@ -18,8 +18,7 @@ type ElementType = {
18
18
  maxLength?: number;
19
19
  fieldNames?: any[];
20
20
  onChange?: (value: string | number | boolean | any[]) => void;
21
- options: any[];
22
- onFocusHandler: () => void;
21
+ dropDownOptions?: any[];
23
22
  };
24
23
 
25
24
  interface ElementExecuterProps$3 extends ElementType {
@@ -62,7 +61,7 @@ declare const CkEditor: (props: ElementExecuterProps) => React$1.JSX.Element;
62
61
 
63
62
  declare const SingleSelectElement: (props: ElementType) => React$1.JSX.Element;
64
63
 
65
- declare const MultipleSelectElement: () => React$1.JSX.Element;
64
+ declare const MultipleSelectElement: (props: ElementType) => React$1.JSX.Element;
66
65
 
67
66
  declare const ButtonElement: () => React$1.JSX.Element;
68
67
 
package/dist/index.d.ts CHANGED
@@ -18,8 +18,7 @@ type ElementType = {
18
18
  maxLength?: number;
19
19
  fieldNames?: any[];
20
20
  onChange?: (value: string | number | boolean | any[]) => void;
21
- options: any[];
22
- onFocusHandler: () => void;
21
+ dropDownOptions?: any[];
23
22
  };
24
23
 
25
24
  interface ElementExecuterProps$3 extends ElementType {
@@ -62,7 +61,7 @@ declare const CkEditor: (props: ElementExecuterProps) => React$1.JSX.Element;
62
61
 
63
62
  declare const SingleSelectElement: (props: ElementType) => React$1.JSX.Element;
64
63
 
65
- declare const MultipleSelectElement: () => React$1.JSX.Element;
64
+ declare const MultipleSelectElement: (props: ElementType) => React$1.JSX.Element;
66
65
 
67
66
  declare const ButtonElement: () => React$1.JSX.Element;
68
67
 
package/dist/index.js CHANGED
@@ -159,7 +159,7 @@ var labelRender = (props) => {
159
159
  return /* @__PURE__ */ import_react5.default.createElement("span", null, "select gender");
160
160
  };
161
161
  var SelectElement = (props) => {
162
- const handleChange3 = (value) => {
162
+ const handleChange = (value) => {
163
163
  if (props.onChange) {
164
164
  props.onChange(value);
165
165
  }
@@ -178,7 +178,7 @@ var SelectElement = (props) => {
178
178
  style: props.styles,
179
179
  className: props.classNames,
180
180
  variant: props.variant,
181
- onChange: handleChange3
181
+ onChange: handleChange
182
182
  }
183
183
  );
184
184
  };
@@ -187,12 +187,12 @@ var SelectElement = (props) => {
187
187
  var import_react6 = __toESM(require("react"));
188
188
  var import_antd6 = require("antd");
189
189
  var RadioElement = (props) => {
190
- const handleChange3 = (e) => {
190
+ const handleChange = (e) => {
191
191
  if (props && props.onChange) {
192
192
  props.onChange(e.target.value);
193
193
  }
194
194
  };
195
- return /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio.Group, { name: "radiogroup", defaultValue: 1 }, /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 1, onChange: handleChange3 }, "A"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 2, onChange: handleChange3 }, "B"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 3, onChange: handleChange3 }, "C"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 4, onChange: handleChange3 }, "D"));
195
+ return /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio.Group, { name: "radiogroup", defaultValue: 1 }, /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 1, onChange: handleChange }, "A"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 2, onChange: handleChange }, "B"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 3, onChange: handleChange }, "C"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 4, onChange: handleChange }, "D"));
196
196
  };
197
197
 
198
198
  // src/Components/Checkbox.tsx
@@ -204,7 +204,7 @@ var defaultCheckedList = [];
204
204
  var CheckboxElement = (props) => {
205
205
  const [checkedList, setCheckedList] = (0, import_react7.useState)(defaultCheckedList);
206
206
  const checkAll = plainOptions.length === checkedList.length;
207
- const handleChange3 = (list) => {
207
+ const handleChange = (list) => {
208
208
  setCheckedList(list);
209
209
  if (props.onChange) {
210
210
  props.onChange(list);
@@ -236,7 +236,7 @@ var CheckboxElement = (props) => {
236
236
  className: props.classNames,
237
237
  options: plainOptions,
238
238
  value: checkedList,
239
- onChange: handleChange3
239
+ onChange: handleChange
240
240
  }
241
241
  ));
242
242
  };
@@ -301,9 +301,12 @@ var onSearch = (value) => {
301
301
  console.log("search:", value);
302
302
  };
303
303
  var filterOption = (input, option) => (option?.label ?? "").toLowerCase().includes(input.toLowerCase());
304
- var handleChange = () => {
305
- };
306
304
  var SingleSelectElement = (props) => {
305
+ const handleChange = (value) => {
306
+ if (props.onChange) {
307
+ props.onChange(value);
308
+ }
309
+ };
307
310
  return /* @__PURE__ */ import_react10.default.createElement(
308
311
  import_antd8.Select,
309
312
  {
@@ -313,8 +316,7 @@ var SingleSelectElement = (props) => {
313
316
  onChange: handleChange,
314
317
  onSearch,
315
318
  filterOption,
316
- onFocus: props.onFocusHandler,
317
- options: props.options
319
+ options: props.dropDownOptions?.map((eachOption) => ({ label: String(eachOption.title), value: String(eachOption.title) }))
318
320
  }
319
321
  );
320
322
  };
@@ -322,46 +324,19 @@ var SingleSelectElement = (props) => {
322
324
  // src/Components/Select/MultipleSelectElement.tsx
323
325
  var import_react11 = __toESM(require("react"));
324
326
  var import_antd9 = require("antd");
325
- var handleChange2 = (value) => {
326
- console.log(`selected ${value}`);
327
- };
328
- var options = [
329
- {
330
- label: "China",
331
- value: "china",
332
- emoji: "\u{1F1E8}\u{1F1F3}",
333
- desc: "China (\u4E2D\u56FD)"
334
- },
335
- {
336
- label: "USA",
337
- value: "usa",
338
- emoji: "\u{1F1FA}\u{1F1F8}",
339
- desc: "USA (\u7F8E\u56FD)"
340
- },
341
- {
342
- label: "Japan",
343
- value: "japan",
344
- emoji: "\u{1F1EF}\u{1F1F5}",
345
- desc: "Japan (\u65E5\u672C)"
346
- },
347
- {
348
- label: "Korea",
349
- value: "korea",
350
- emoji: "\u{1F1F0}\u{1F1F7}",
351
- desc: "Korea (\u97E9\u56FD)"
352
- }
353
- ];
354
- var MultipleSelectElement = () => {
327
+ var MultipleSelectElement = (props) => {
328
+ const handleChange = (value) => {
329
+ if (props.onChange) {
330
+ props.onChange(value);
331
+ }
332
+ };
355
333
  return /* @__PURE__ */ import_react11.default.createElement(
356
334
  import_antd9.Select,
357
335
  {
358
336
  mode: "multiple",
359
- style: { width: "100%" },
360
- placeholder: "select one country",
361
- defaultValue: ["china"],
362
- onChange: handleChange2,
363
- options,
364
- optionRender: (option) => /* @__PURE__ */ import_react11.default.createElement(import_antd9.Space, null, /* @__PURE__ */ import_react11.default.createElement("span", { role: "img", "aria-label": option.data.label }, option.data.emoji), option.data.desc)
337
+ placeholder: props.placeholder,
338
+ onChange: handleChange,
339
+ options: props.dropDownOptions?.map((eachOption) => ({ label: String(eachOption.title), value: String(eachOption.title) }))
365
340
  }
366
341
  );
367
342
  };
package/dist/index.mjs CHANGED
@@ -113,7 +113,7 @@ var labelRender = (props) => {
113
113
  return /* @__PURE__ */ React5.createElement("span", null, "select gender");
114
114
  };
115
115
  var SelectElement = (props) => {
116
- const handleChange3 = (value) => {
116
+ const handleChange = (value) => {
117
117
  if (props.onChange) {
118
118
  props.onChange(value);
119
119
  }
@@ -132,7 +132,7 @@ var SelectElement = (props) => {
132
132
  style: props.styles,
133
133
  className: props.classNames,
134
134
  variant: props.variant,
135
- onChange: handleChange3
135
+ onChange: handleChange
136
136
  }
137
137
  );
138
138
  };
@@ -141,12 +141,12 @@ var SelectElement = (props) => {
141
141
  import React6 from "react";
142
142
  import { Radio } from "antd";
143
143
  var RadioElement = (props) => {
144
- const handleChange3 = (e) => {
144
+ const handleChange = (e) => {
145
145
  if (props && props.onChange) {
146
146
  props.onChange(e.target.value);
147
147
  }
148
148
  };
149
- return /* @__PURE__ */ React6.createElement(Radio.Group, { name: "radiogroup", defaultValue: 1 }, /* @__PURE__ */ React6.createElement(Radio, { value: 1, onChange: handleChange3 }, "A"), /* @__PURE__ */ React6.createElement(Radio, { value: 2, onChange: handleChange3 }, "B"), /* @__PURE__ */ React6.createElement(Radio, { value: 3, onChange: handleChange3 }, "C"), /* @__PURE__ */ React6.createElement(Radio, { value: 4, onChange: handleChange3 }, "D"));
149
+ return /* @__PURE__ */ React6.createElement(Radio.Group, { name: "radiogroup", defaultValue: 1 }, /* @__PURE__ */ React6.createElement(Radio, { value: 1, onChange: handleChange }, "A"), /* @__PURE__ */ React6.createElement(Radio, { value: 2, onChange: handleChange }, "B"), /* @__PURE__ */ React6.createElement(Radio, { value: 3, onChange: handleChange }, "C"), /* @__PURE__ */ React6.createElement(Radio, { value: 4, onChange: handleChange }, "D"));
150
150
  };
151
151
 
152
152
  // src/Components/Checkbox.tsx
@@ -158,7 +158,7 @@ var defaultCheckedList = [];
158
158
  var CheckboxElement = (props) => {
159
159
  const [checkedList, setCheckedList] = useState2(defaultCheckedList);
160
160
  const checkAll = plainOptions.length === checkedList.length;
161
- const handleChange3 = (list) => {
161
+ const handleChange = (list) => {
162
162
  setCheckedList(list);
163
163
  if (props.onChange) {
164
164
  props.onChange(list);
@@ -190,7 +190,7 @@ var CheckboxElement = (props) => {
190
190
  className: props.classNames,
191
191
  options: plainOptions,
192
192
  value: checkedList,
193
- onChange: handleChange3
193
+ onChange: handleChange
194
194
  }
195
195
  ));
196
196
  };
@@ -255,9 +255,12 @@ var onSearch = (value) => {
255
255
  console.log("search:", value);
256
256
  };
257
257
  var filterOption = (input, option) => (option?.label ?? "").toLowerCase().includes(input.toLowerCase());
258
- var handleChange = () => {
259
- };
260
258
  var SingleSelectElement = (props) => {
259
+ const handleChange = (value) => {
260
+ if (props.onChange) {
261
+ props.onChange(value);
262
+ }
263
+ };
261
264
  return /* @__PURE__ */ React9.createElement(
262
265
  Select2,
263
266
  {
@@ -267,55 +270,27 @@ var SingleSelectElement = (props) => {
267
270
  onChange: handleChange,
268
271
  onSearch,
269
272
  filterOption,
270
- onFocus: props.onFocusHandler,
271
- options: props.options
273
+ options: props.dropDownOptions?.map((eachOption) => ({ label: String(eachOption.title), value: String(eachOption.title) }))
272
274
  }
273
275
  );
274
276
  };
275
277
 
276
278
  // src/Components/Select/MultipleSelectElement.tsx
277
279
  import React10 from "react";
278
- import { Select as Select3, Space as Space2 } from "antd";
279
- var handleChange2 = (value) => {
280
- console.log(`selected ${value}`);
281
- };
282
- var options = [
283
- {
284
- label: "China",
285
- value: "china",
286
- emoji: "\u{1F1E8}\u{1F1F3}",
287
- desc: "China (\u4E2D\u56FD)"
288
- },
289
- {
290
- label: "USA",
291
- value: "usa",
292
- emoji: "\u{1F1FA}\u{1F1F8}",
293
- desc: "USA (\u7F8E\u56FD)"
294
- },
295
- {
296
- label: "Japan",
297
- value: "japan",
298
- emoji: "\u{1F1EF}\u{1F1F5}",
299
- desc: "Japan (\u65E5\u672C)"
300
- },
301
- {
302
- label: "Korea",
303
- value: "korea",
304
- emoji: "\u{1F1F0}\u{1F1F7}",
305
- desc: "Korea (\u97E9\u56FD)"
306
- }
307
- ];
308
- var MultipleSelectElement = () => {
280
+ import { Select as Select3 } from "antd";
281
+ var MultipleSelectElement = (props) => {
282
+ const handleChange = (value) => {
283
+ if (props.onChange) {
284
+ props.onChange(value);
285
+ }
286
+ };
309
287
  return /* @__PURE__ */ React10.createElement(
310
288
  Select3,
311
289
  {
312
290
  mode: "multiple",
313
- style: { width: "100%" },
314
- placeholder: "select one country",
315
- defaultValue: ["china"],
316
- onChange: handleChange2,
317
- options,
318
- optionRender: (option) => /* @__PURE__ */ React10.createElement(Space2, null, /* @__PURE__ */ React10.createElement("span", { role: "img", "aria-label": option.data.label }, option.data.emoji), option.data.desc)
291
+ placeholder: props.placeholder,
292
+ onChange: handleChange,
293
+ options: props.dropDownOptions?.map((eachOption) => ({ label: String(eachOption.title), value: String(eachOption.title) }))
319
294
  }
320
295
  );
321
296
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.8-Beta0",
3
+ "version": "0.0.8-Beta10",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",