@fctc/sme-widget-ui 1.7.5 → 1.7.7

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
@@ -2,6 +2,6 @@ export { useClickOutside, useFileInfo } from './hooks.mjs';
2
2
  export { AddIcon, ArchiveIcon, ArrowDownIcon, ArrowRightIcon, AttachIcon, BackIcon, CalendarIcon, CheckIcon, ChevronBottomIcon, CloseIcon, CopyIcon, DeleteIcon, DeleteIconDanger, DownloadIcon, ExcelIcon, ExportIcon, EyeClosedIcon, EyeIcon, FilterIcon, GoogleIcon, GroupByIcon, KanbanIcon, ListIcon, LoadingIcon, MoreIcon, PaidIcon, PdfIcon, PlaceHolderIcon, PlayIcon, ResetIcon, SearchIcon, SettingIcon, StarIcon, TriangleIcon, UnArchiveIcon, VectorIcon, ZipIcon } from './icons.mjs';
3
3
  export { IInputFieldProps, LoginData, LoginProps, Provider, ValuePropsType, loginSchema } from './types.mjs';
4
4
  export { ActiveBadgeField, AvatarField, BinaryField, ButtonBadgeField, ButtonField, ButtonSelectFiles, CharField, CheckboxField, ColorField, ColorWrapper, CopyLinkButtonField, DateField, DateOptionField, DownLoadBinaryField, DownloadFileField, DropdownField, EmptyTable, FeeField, FileUploadField, FloatField, FloatTimeField, HtmlField, IActiveBadgeProps, IAvatarProps, IBinaryFieldProps, IButtonBadgeProps, IButtonProps, ICharFieldProps, IColorFieldProps, IColorWrapperProps, ICopyLinkButtonProps, IDateFieldProps, IDownLoadBinary, IDownloadFileProps, IDurationProps, IFileUploadProps, IMany2ManyTagsProps, IMonetaryProps, IOptionProps, IPaginationProps, IPriorityFieldProps, IRadioGroupProps, IRatingStarProps, ISelectDropdownProps, IStatusDropdownFieldProps, ImageField, InfomationField, IntegerField, LayerLoading, LoadingSmall, Login, Many2ManyField, Many2ManyProps, Many2ManyTagField, Many2OneField, Many2OneProps, ModalConfirm, ModalDetail, ModalLayer, MonetaryField, PaginationView, PaidBadgedField, PriorityField, RadioGroupField, RatingStarField, RemainingDaysField, RenderFiles, Row, Search, SelectDropdownField, StatusBarOptionField, StatusDropdownField, StatusbarDurationField, TDropdownSelectorProps, TableBody, TableFilter, TableFooter, TableGroup, TableHead, TextAreaField, ToggleButtonField, VideoPlayer, usePagination } from './widgets.mjs';
5
- export { COLORS, DOTS, SearchType, checkIsImageLink, convertFloatToTime, convertTimeToFloat, formatFileSize, formatFloatNumber, formatNumberOnly, getPasswordMessage, isBase64Image, isObjectEmpty, parseFormattedNumber, range, typeStyles, useFormatDate, validateAndParseDate, validateInput } from './utils.mjs';
5
+ export { COLORS, DOTS, SearchType, checkIsImageLink, convertFloatToTime, convertTimeToFloat, formatFileSize, formatFloatNumber, formatNumberOnly, getPasswordMessage, isBase64Image, isObjectEmpty, parseFormattedNumber, range, useFormatDate, validateAndParseDate, validateInput } from './utils.mjs';
6
6
  import 'react';
7
7
  import 'zod';
package/dist/index.d.ts CHANGED
@@ -2,6 +2,6 @@ export { useClickOutside, useFileInfo } from './hooks.js';
2
2
  export { AddIcon, ArchiveIcon, ArrowDownIcon, ArrowRightIcon, AttachIcon, BackIcon, CalendarIcon, CheckIcon, ChevronBottomIcon, CloseIcon, CopyIcon, DeleteIcon, DeleteIconDanger, DownloadIcon, ExcelIcon, ExportIcon, EyeClosedIcon, EyeIcon, FilterIcon, GoogleIcon, GroupByIcon, KanbanIcon, ListIcon, LoadingIcon, MoreIcon, PaidIcon, PdfIcon, PlaceHolderIcon, PlayIcon, ResetIcon, SearchIcon, SettingIcon, StarIcon, TriangleIcon, UnArchiveIcon, VectorIcon, ZipIcon } from './icons.js';
3
3
  export { IInputFieldProps, LoginData, LoginProps, Provider, ValuePropsType, loginSchema } from './types.js';
4
4
  export { ActiveBadgeField, AvatarField, BinaryField, ButtonBadgeField, ButtonField, ButtonSelectFiles, CharField, CheckboxField, ColorField, ColorWrapper, CopyLinkButtonField, DateField, DateOptionField, DownLoadBinaryField, DownloadFileField, DropdownField, EmptyTable, FeeField, FileUploadField, FloatField, FloatTimeField, HtmlField, IActiveBadgeProps, IAvatarProps, IBinaryFieldProps, IButtonBadgeProps, IButtonProps, ICharFieldProps, IColorFieldProps, IColorWrapperProps, ICopyLinkButtonProps, IDateFieldProps, IDownLoadBinary, IDownloadFileProps, IDurationProps, IFileUploadProps, IMany2ManyTagsProps, IMonetaryProps, IOptionProps, IPaginationProps, IPriorityFieldProps, IRadioGroupProps, IRatingStarProps, ISelectDropdownProps, IStatusDropdownFieldProps, ImageField, InfomationField, IntegerField, LayerLoading, LoadingSmall, Login, Many2ManyField, Many2ManyProps, Many2ManyTagField, Many2OneField, Many2OneProps, ModalConfirm, ModalDetail, ModalLayer, MonetaryField, PaginationView, PaidBadgedField, PriorityField, RadioGroupField, RatingStarField, RemainingDaysField, RenderFiles, Row, Search, SelectDropdownField, StatusBarOptionField, StatusDropdownField, StatusbarDurationField, TDropdownSelectorProps, TableBody, TableFilter, TableFooter, TableGroup, TableHead, TextAreaField, ToggleButtonField, VideoPlayer, usePagination } from './widgets.js';
5
- export { COLORS, DOTS, SearchType, checkIsImageLink, convertFloatToTime, convertTimeToFloat, formatFileSize, formatFloatNumber, formatNumberOnly, getPasswordMessage, isBase64Image, isObjectEmpty, parseFormattedNumber, range, typeStyles, useFormatDate, validateAndParseDate, validateInput } from './utils.js';
5
+ export { COLORS, DOTS, SearchType, checkIsImageLink, convertFloatToTime, convertTimeToFloat, formatFileSize, formatFloatNumber, formatNumberOnly, getPasswordMessage, isBase64Image, isObjectEmpty, parseFormattedNumber, range, useFormatDate, validateAndParseDate, validateInput } from './utils.js';
6
6
  import 'react';
7
7
  import 'zod';
package/dist/index.js CHANGED
@@ -4297,7 +4297,7 @@ var require_react_is_development = __commonJS({
4297
4297
  var ContextProvider = REACT_PROVIDER_TYPE;
4298
4298
  var Element2 = REACT_ELEMENT_TYPE;
4299
4299
  var ForwardRef = REACT_FORWARD_REF_TYPE;
4300
- var Fragment32 = REACT_FRAGMENT_TYPE;
4300
+ var Fragment33 = REACT_FRAGMENT_TYPE;
4301
4301
  var Lazy = REACT_LAZY_TYPE;
4302
4302
  var Memo = REACT_MEMO_TYPE;
4303
4303
  var Portal2 = REACT_PORTAL_TYPE;
@@ -4356,7 +4356,7 @@ var require_react_is_development = __commonJS({
4356
4356
  exports2.ContextProvider = ContextProvider;
4357
4357
  exports2.Element = Element2;
4358
4358
  exports2.ForwardRef = ForwardRef;
4359
- exports2.Fragment = Fragment32;
4359
+ exports2.Fragment = Fragment33;
4360
4360
  exports2.Lazy = Lazy;
4361
4361
  exports2.Memo = Memo;
4362
4362
  exports2.Portal = Portal2;
@@ -5046,7 +5046,6 @@ __export(index_exports, {
5046
5046
  loginSchema: () => loginSchema,
5047
5047
  parseFormattedNumber: () => parseFormattedNumber,
5048
5048
  range: () => range,
5049
- typeStyles: () => typeStyles,
5050
5049
  useClickOutside: () => useClickOutside,
5051
5050
  useFileInfo: () => useFileInfo,
5052
5051
  useFormatDate: () => useFormatDate,
@@ -7846,16 +7845,6 @@ var COLORS = [
7846
7845
  }
7847
7846
  ];
7848
7847
  var DOTS = "...";
7849
- var typeStyles = {
7850
- primary: "bg-blue-500 text-white",
7851
- secondary: "bg-lime-600 text-white",
7852
- danger: "bg-[rgba(237,28,36,0.1)] text-[#F5222D]",
7853
- info: "bg-[rgba(5,152,237,0.12)] text-[rgb(5,152,237)]",
7854
- success: "bg-[rgba(46,181,83,0.1)] text-[rgb(46,181,83)]",
7855
- warning: "bg-[rgba(237,166,28,0.1)] text-[rgb(250,140,22)]",
7856
- default: "bg-[#dee2e6]",
7857
- light: "bg-white text-gray-800 shadow-md"
7858
- };
7859
7848
  var SearchType = {
7860
7849
  FILTER: "filter_by",
7861
7850
  SEARCH: "search_by",
@@ -18501,6 +18490,58 @@ var BinaryField = (props) => {
18501
18490
 
18502
18491
  // src/widgets/basic/button-badge-field/button-badge.tsx
18503
18492
  var import_jsx_runtime71 = require("react/jsx-runtime");
18493
+ var typeStyles = {
18494
+ primary: {
18495
+ backgroundColor: "#3b82f6",
18496
+ color: "#fff",
18497
+ border: "1px solid #fff"
18498
+ },
18499
+ secondary: {
18500
+ backgroundColor: "#EBF1FF",
18501
+ color: "#2597D0",
18502
+ border: "1px solid #35ADE9"
18503
+ },
18504
+ danger: {
18505
+ backgroundColor: "#FFEBEC",
18506
+ color: "#E93544",
18507
+ border: "1px solid #FB2B3D"
18508
+ },
18509
+ info: {
18510
+ backgroundColor: "rgba(5,152,237,0.12)",
18511
+ color: "rgb(5,152,237)",
18512
+ border: "1px solid rgb(5,152,237)"
18513
+ },
18514
+ success: {
18515
+ backgroundColor: "#E0FAEB",
18516
+ color: "#12AF53",
18517
+ border: "1px solid #1FC163"
18518
+ },
18519
+ warning: {
18520
+ backgroundColor: "#FFFAEB",
18521
+ color: "#E6A819)",
18522
+ border: "1px solid #F6B51E"
18523
+ },
18524
+ default: {
18525
+ backgroundColor: "#dee2e6",
18526
+ color: "#000",
18527
+ border: "1px solid #000"
18528
+ },
18529
+ light: {
18530
+ backgroundColor: "#fff",
18531
+ color: "#1f2937",
18532
+ border: "1px solid #1f2937"
18533
+ }
18534
+ };
18535
+ var baseStyle = {
18536
+ borderRadius: "4px",
18537
+ fontSize: "12px",
18538
+ padding: "4px 8px",
18539
+ width: "fit-content",
18540
+ textAlign: "center",
18541
+ fontWeight: 500,
18542
+ cursor: "pointer",
18543
+ transition: "all 0.3s ease-in-out"
18544
+ };
18504
18545
  var ButtonBadgeField = (props) => {
18505
18546
  const { defaultValue, selection, value, formValues, domainHelper } = props;
18506
18547
  const decorationSuccess = props["decoration-success"] && domainHelper.checkDomain(formValues, props["decoration-success"]);
@@ -18508,31 +18549,21 @@ var ButtonBadgeField = (props) => {
18508
18549
  const decorationDanger = props["decoration-danger"] && domainHelper.checkDomain(formValues, props["decoration-danger"]);
18509
18550
  const decorationWarning = props["decoration-warning"] && domainHelper.checkDomain(formValues, props["decoration-warning"]);
18510
18551
  const getType = () => {
18511
- if (decorationInfo) {
18512
- return typeStyles["info"];
18513
- }
18514
- if (decorationSuccess) {
18515
- return typeStyles["success"];
18516
- }
18517
- if (decorationDanger) {
18518
- return typeStyles["danger"];
18519
- }
18520
- if (decorationWarning) {
18521
- return typeStyles["warning"];
18522
- }
18552
+ if (decorationInfo) return typeStyles["info"];
18553
+ if (decorationSuccess) return typeStyles["success"];
18554
+ if (decorationDanger) return typeStyles["danger"];
18555
+ if (decorationWarning) return typeStyles["warning"];
18523
18556
  return typeStyles["default"];
18524
18557
  };
18525
- const baseStyle = "rounded-full text-xs px-[0.82rem] w-fit py-1 text-center font-medium cursor-pointer transition duration-300 ease-in-out transform";
18526
- const buttonClass = `${baseStyle} ${getType()}`;
18527
18558
  const getLabel = (value2) => {
18528
18559
  if (!value2) return "";
18529
- const item = selection?.find((item2) => {
18530
- return Array.isArray(item2) && item2[0] === value2;
18531
- });
18560
+ const item = selection?.find(
18561
+ (item2) => Array.isArray(item2) && item2[0] === value2
18562
+ );
18532
18563
  return item ? item[1] : "";
18533
18564
  };
18534
18565
  const label = getLabel(defaultValue ?? value);
18535
- return label ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: buttonClass, children: i18n_default.t(label) }) : null;
18566
+ return label ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { style: { ...baseStyle, ...getType() }, children: i18n_default.t(label) }) : null;
18536
18567
  };
18537
18568
 
18538
18569
  // src/widgets/basic/button-field/button.tsx
@@ -35276,82 +35307,136 @@ var import_jsx_runtime105 = require("react/jsx-runtime");
35276
35307
  var StatusBarOptionField = (props) => {
35277
35308
  const { selection, defaultValue } = props;
35278
35309
  const memoizedStatusOptions = (0, import_react66.useMemo)(() => selection, [selection]);
35310
+ const indexInProgress = memoizedStatusOptions?.findIndex(
35311
+ (option) => option?.[0] === defaultValue
35312
+ );
35279
35313
  return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
35280
35314
  "div",
35281
35315
  {
35282
35316
  style: {
35283
35317
  display: "flex",
35284
35318
  alignItems: "center",
35285
- flexWrap: "wrap",
35286
- overflow: "hidden"
35319
+ flexWrap: "wrap"
35287
35320
  },
35288
35321
  children: memoizedStatusOptions?.map((option, index4) => {
35289
- const value = option?.[0] === defaultValue;
35290
- return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
35291
- "label",
35292
- {
35293
- style: {
35294
- position: "relative",
35295
- flexShrink: 0,
35296
- cursor: "default",
35297
- height: "36px",
35298
- display: "flex",
35299
- alignItems: "center",
35300
- paddingLeft: "32px",
35301
- // pl-8
35302
- paddingRight: "20px",
35303
- // pr-[20px]
35304
- fontWeight: 600,
35305
- // font-semibold
35306
- fontSize: "14px",
35307
- background: value ? "var(--color-primary)" : "#FAFAFA",
35308
- color: value ? "#fff" : "#121212",
35309
- borderTopLeftRadius: index4 === 0 ? "0.75rem" : "0px",
35310
- // rounded-l-xl
35311
- borderBottomLeftRadius: index4 === 0 ? "0.75rem" : "0px",
35312
- borderTopRightRadius: index4 === memoizedStatusOptions?.length - 1 ? "0.75rem" : "0px",
35313
- // rounded-r-xl
35314
- borderBottomRightRadius: index4 === memoizedStatusOptions?.length - 1 ? "0.75rem" : "0px"
35315
- },
35316
- children: [
35317
- /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
35318
- "input",
35319
- {
35320
- type: "radio",
35321
- checked: value,
35322
- style: { display: "none" },
35323
- disabled: true
35324
- }
35325
- ),
35326
- option[1],
35327
- !(index4 === memoizedStatusOptions?.length - 1) && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
35328
- "div",
35329
- {
35330
- style: {
35331
- position: "absolute",
35332
- top: "50%",
35333
- transform: "translateY(-50%) rotate(45deg)",
35334
- zIndex: 2,
35335
- width: "26px",
35336
- height: "26px",
35337
- right: "-13px",
35338
- background: value ? "var(--color-primary)" : "#FAFAFA",
35339
- border: value ? "none" : "1px solid rgba(0,0,0,0.04)",
35340
- borderBottomColor: value ? "var(--color-primary)" : "#FAFAFA",
35341
- borderLeftColor: value ? "var(--color-primary)" : "#FAFAFA",
35342
- borderTopColor: value ? "var(--color-primary)" : "rgba(0,0,0,0.04)",
35343
- borderRightColor: value ? "var(--color-primary)" : "rgba(0,0,0,0.04)"
35322
+ return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
35323
+ /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
35324
+ "div",
35325
+ {
35326
+ style: {
35327
+ position: "relative",
35328
+ flexShrink: 0,
35329
+ cursor: "default",
35330
+ padding: "4px",
35331
+ display: "flex",
35332
+ alignItems: "center",
35333
+ fontWeight: 600,
35334
+ fontSize: "12px",
35335
+ background: index4 < indexInProgress || indexInProgress === memoizedStatusOptions?.length - 1 ? "#D5F1E0" : index4 === indexInProgress ? "#FFF" : "#F3F3F3",
35336
+ color: index4 < indexInProgress || indexInProgress === memoizedStatusOptions?.length - 1 ? "#178C48" : index4 === indexInProgress ? "#666" : "#AEAEAE",
35337
+ borderRadius: "16px",
35338
+ boxShadow: index4 === indexInProgress ? "0 1px 2px 0 rgba(51, 51, 51, 0.04), 0 2px 4px 0 rgba(51, 51, 51, 0.04), 0 4px 8px -2px rgba(51, 51, 51, 0.06), 0 0 0 1px rgba(51, 51, 51, 0.04), 0 -1px 1px -0.5px rgba(51, 51, 51, 0.06) inset" : ""
35339
+ },
35340
+ children: [
35341
+ /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
35342
+ "span",
35343
+ {
35344
+ style: {
35345
+ backgroundColor: index4 < indexInProgress || indexInProgress === memoizedStatusOptions?.length - 1 ? "#178C48" : index4 === indexInProgress ? "#FF3F89" : "#FFF",
35346
+ width: 20,
35347
+ height: 20,
35348
+ display: "flex",
35349
+ justifyContent: "center",
35350
+ alignItems: "center",
35351
+ borderRadius: "100%"
35352
+ },
35353
+ children: index4 < indexInProgress || indexInProgress === memoizedStatusOptions?.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ICCheck, {}) : index4 === indexInProgress ? /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ICCircle, {}) : /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ICMinus, {})
35344
35354
  }
35345
- }
35346
- )
35347
- ]
35348
- },
35349
- option?.[0]
35350
- );
35355
+ ),
35356
+ /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
35357
+ "span",
35358
+ {
35359
+ style: {
35360
+ padding: "0 6px"
35361
+ },
35362
+ children: option[1]
35363
+ }
35364
+ )
35365
+ ]
35366
+ },
35367
+ option?.[0]
35368
+ ),
35369
+ !(index4 === memoizedStatusOptions?.length - 1) && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
35370
+ "div",
35371
+ {
35372
+ style: {
35373
+ height: "3px",
35374
+ width: "6px",
35375
+ backgroundColor: "#F3F3F3"
35376
+ }
35377
+ }
35378
+ )
35379
+ ] });
35351
35380
  })
35352
35381
  }
35353
35382
  );
35354
35383
  };
35384
+ var ICMinus = () => {
35385
+ return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
35386
+ "svg",
35387
+ {
35388
+ xmlns: "http://www.w3.org/2000/svg",
35389
+ width: "16",
35390
+ height: "16",
35391
+ viewBox: "0 0 16 16",
35392
+ fill: "none",
35393
+ children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
35394
+ "path",
35395
+ {
35396
+ d: "M4 8H12",
35397
+ stroke: "#C3C3C3",
35398
+ "stroke-width": "1.5",
35399
+ "stroke-linecap": "round",
35400
+ "stroke-linejoin": "round"
35401
+ }
35402
+ )
35403
+ }
35404
+ );
35405
+ };
35406
+ var ICCircle = () => {
35407
+ return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
35408
+ "svg",
35409
+ {
35410
+ xmlns: "http://www.w3.org/2000/svg",
35411
+ width: "8",
35412
+ height: "8",
35413
+ viewBox: "0 0 8 8",
35414
+ fill: "none",
35415
+ children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("circle", { cx: "4", cy: "4", r: "4", fill: "white" })
35416
+ }
35417
+ );
35418
+ };
35419
+ var ICCheck = () => {
35420
+ return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
35421
+ "svg",
35422
+ {
35423
+ xmlns: "http://www.w3.org/2000/svg",
35424
+ width: "16",
35425
+ height: "16",
35426
+ viewBox: "0 0 16 16",
35427
+ fill: "none",
35428
+ children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
35429
+ "path",
35430
+ {
35431
+ d: "M13.3408 5.23535L13.252 5.32324L6.88867 11.6875L6.7998 11.7764L6.71191 11.6875L2.89258 7.86914L2.80469 7.78125L2.89258 7.69238L3.74121 6.84375L3.83008 6.75586L6.7998 9.72559L12.2266 4.29785L12.3154 4.20996L13.3408 5.23535Z",
35432
+ fill: "white",
35433
+ stroke: "white",
35434
+ "stroke-width": "0.25"
35435
+ }
35436
+ )
35437
+ }
35438
+ );
35439
+ };
35355
35440
 
35356
35441
  // src/widgets/basic/date-option-field/date-option.tsx
35357
35442
  var import_jsx_runtime106 = require("react/jsx-runtime");
@@ -35512,7 +35597,6 @@ var DateOptionField = (props) => {
35512
35597
  loginSchema,
35513
35598
  parseFormattedNumber,
35514
35599
  range,
35515
- typeStyles,
35516
35600
  useClickOutside,
35517
35601
  useFileInfo,
35518
35602
  useFormatDate,