bj-web-components 0.2.28 → 0.2.29

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.
Files changed (90) hide show
  1. package/dist/index.js +1 -51
  2. package/dist/index.mjs +49 -49
  3. package/dist/style.css +1 -3744
  4. package/dist/web/BasicInput/BInput.js +1 -208
  5. package/dist/web/BasicInput/BInput.mjs +132 -164
  6. package/dist/web/BasicInput/utils.js +1 -47
  7. package/dist/web/BasicInput/utils.mjs +28 -38
  8. package/dist/web/CategoryDropdown/CategoryDropdown.js +1 -307
  9. package/dist/web/CategoryDropdown/CategoryDropdown.mjs +170 -218
  10. package/dist/web/CheckBox/BCheckBox.js +1 -116
  11. package/dist/web/CheckBox/BCheckBox.mjs +70 -86
  12. package/dist/web/CheckBox/Group.js +1 -73
  13. package/dist/web/CheckBox/Group.mjs +56 -63
  14. package/dist/web/CheckBox/context.js +1 -5
  15. package/dist/web/CheckBox/context.mjs +3 -3
  16. package/dist/web/CheckBox/index.js +1 -8
  17. package/dist/web/CheckBox/index.mjs +6 -6
  18. package/dist/web/Dropdown/BDropdown.js +1 -186
  19. package/dist/web/Dropdown/BDropdown.mjs +106 -132
  20. package/dist/web/EmptyInputBox/EmptyInputBox.js +1 -77
  21. package/dist/web/EmptyInputBox/EmptyInputBox.mjs +48 -52
  22. package/dist/web/FileCard/FileCard.js +1 -157
  23. package/dist/web/FileCard/FileCard.mjs +82 -112
  24. package/dist/web/Icon/Icon.js +1 -9
  25. package/dist/web/Icon/Icon.mjs +6 -6
  26. package/dist/web/Input/Input.js +1 -181
  27. package/dist/web/Input/Input.mjs +113 -122
  28. package/dist/web/InputNumber/BInputNumber.js +1 -311
  29. package/dist/web/InputNumber/BInputNumber.mjs +167 -275
  30. package/dist/web/InputNumber/StepHandler.js +1 -69
  31. package/dist/web/InputNumber/StepHandler.mjs +32 -38
  32. package/dist/web/InputNumber/hooks/useCursor.js +1 -40
  33. package/dist/web/InputNumber/hooks/useCursor.mjs +33 -35
  34. package/dist/web/InputNumber/hooks/useFrame.js +1 -12
  35. package/dist/web/InputNumber/hooks/useFrame.mjs +6 -9
  36. package/dist/web/InputNumber/utils/decimal.js +1 -147
  37. package/dist/web/InputNumber/utils/decimal.mjs +81 -109
  38. package/dist/web/Modal/Modal.js +1 -84
  39. package/dist/web/Modal/Modal.mjs +49 -52
  40. package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +1 -232
  41. package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +125 -206
  42. package/dist/web/Pagination/Pagination.js +1 -328
  43. package/dist/web/Pagination/Pagination.mjs +178 -254
  44. package/dist/web/ProductField/ProductField.js +1 -272
  45. package/dist/web/ProductField/ProductField.mjs +143 -190
  46. package/dist/web/ProductField/arrow-up.svg.js +1 -3
  47. package/dist/web/ProductField/arrow-up.svg.mjs +2 -2
  48. package/dist/web/ProductField/checkbox-no.svg.js +1 -3
  49. package/dist/web/ProductField/checkbox-no.svg.mjs +2 -2
  50. package/dist/web/ProductField/checkbox-ok.svg.js +1 -3
  51. package/dist/web/ProductField/checkbox-ok.svg.mjs +2 -2
  52. package/dist/web/ProductField/no_data_light.svg.js +1 -3
  53. package/dist/web/ProductField/no_data_light.svg.mjs +2 -2
  54. package/dist/web/ProductField/search.svg.js +1 -3
  55. package/dist/web/ProductField/search.svg.mjs +2 -2
  56. package/dist/web/ProductField/sort.svg.js +1 -3
  57. package/dist/web/ProductField/sort.svg.mjs +2 -2
  58. package/dist/web/SkuInputCard/SkuInputCard.js +1 -276
  59. package/dist/web/SkuInputCard/SkuInputCard.mjs +149 -188
  60. package/dist/web/SkuInputCard/spin_loading_red.gif.js +1 -3
  61. package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +2 -2
  62. package/dist/web/Switch/Switch.js +1 -70
  63. package/dist/web/Switch/Switch.mjs +37 -47
  64. package/dist/web/Table/BTable.js +1 -950
  65. package/dist/web/Table/BTable.mjs +521 -767
  66. package/dist/web/Table/Column.js +1 -5
  67. package/dist/web/Table/Column.mjs +2 -2
  68. package/dist/web/Table/ColumnGroup.js +1 -5
  69. package/dist/web/Table/ColumnGroup.mjs +2 -2
  70. package/dist/web/Table/utils/columns.js +1 -48
  71. package/dist/web/Table/utils/columns.mjs +30 -35
  72. package/dist/web/Table/utils/sortFilter.js +1 -84
  73. package/dist/web/Table/utils/sortFilter.mjs +52 -73
  74. package/dist/web/Tabs/BTabs.js +1 -150
  75. package/dist/web/Tabs/BTabs.mjs +98 -118
  76. package/dist/web/Tabs/TabPane.js +1 -8
  77. package/dist/web/Tabs/TabPane.mjs +4 -4
  78. package/dist/web/Tooltip/ConfirmTooltip.js +1 -26
  79. package/dist/web/Tooltip/ConfirmTooltip.mjs +19 -20
  80. package/dist/web/Tooltip/ContentTooltip.js +1 -94
  81. package/dist/web/Tooltip/ContentTooltip.mjs +62 -72
  82. package/dist/web/Tooltip/ProgressTooltip.js +1 -36
  83. package/dist/web/Tooltip/ProgressTooltip.mjs +20 -22
  84. package/dist/web/Tooltip/TooltipWrapper.js +1 -12
  85. package/dist/web/Tooltip/TooltipWrapper.mjs +8 -8
  86. package/dist/web/Tooltip/useAutoPlacement.js +1 -41
  87. package/dist/web/Tooltip/useAutoPlacement.mjs +25 -34
  88. package/dist/web.js +1 -51
  89. package/dist/web.mjs +49 -49
  90. package/package.json +1 -1
@@ -1,270 +1,231 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { useRef, useState, useEffect } from "react";
1
+ import { jsxs as c, jsx as t, Fragment as B } from "react/jsx-runtime";
2
+ import { useRef as v, useState as k, useEffect as A } from "react";
3
3
  /* empty css */
4
- import loadingIndicator from "./spin_loading_red.gif.mjs";
5
- function DragIcon() {
6
- return /* @__PURE__ */ jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M12.8333 8.66683H16.1666V5.3335H12.8333M12.8333 13.6668H16.1666V10.3335H12.8333M7.83331 13.6668H11.1666V10.3335H7.83331M7.83331 18.6668H11.1666V15.3335H7.83331M12.8333 18.6668H16.1666V15.3335H12.8333M7.83331 8.66683H11.1666V5.3335H7.83331V8.66683Z", fill: "currentColor" }) });
4
+ import c1 from "./spin_loading_red.gif.mjs";
5
+ function e1() {
6
+ return /* @__PURE__ */ t("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ t("path", { d: "M12.8333 8.66683H16.1666V5.3335H12.8333M12.8333 13.6668H16.1666V10.3335H12.8333M7.83331 13.6668H11.1666V10.3335H7.83331M7.83331 18.6668H11.1666V15.3335H7.83331M12.8333 18.6668H16.1666V15.3335H12.8333M7.83331 8.66683H11.1666V5.3335H7.83331V8.66683Z", fill: "currentColor" }) });
7
7
  }
8
- function DeleteIcon() {
9
- return /* @__PURE__ */ jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M14.1667 5.3335C15.1792 5.3335 16 6.15431 16 7.16683V8.00016H19C19.2761 8.00016 19.5 8.22402 19.5 8.50016C19.5 8.7763 19.2761 9.00016 19 9.00016H17.3333V16.8335C17.3333 17.846 16.5125 18.6668 15.5 18.6668H8.5C7.48748 18.6668 6.66667 17.846 6.66667 16.8335V9.00016H5C4.72386 9.00016 4.5 8.7763 4.5 8.50016C4.5 8.22402 4.72386 8.00016 5 8.00016H8V7.16683C8 6.15431 8.82081 5.3335 9.83333 5.3335H14.1667ZM7.66667 16.8335C7.66667 17.2937 8.03976 17.6668 8.5 17.6668H15.5C15.9602 17.6668 16.3333 17.2937 16.3333 16.8335V9.00016H7.66667V16.8335ZM10.5 11.3335C10.7761 11.3335 11 11.5574 11 11.8335V15.0002C11 15.2763 10.7761 15.5002 10.5 15.5002C10.2239 15.5002 10 15.2763 10 15.0002V11.8335C10 11.5574 10.2239 11.3335 10.5 11.3335ZM13.5 11.3335C13.7761 11.3335 14 11.5574 14 11.8335V15.0002C14 15.2763 13.7761 15.5002 13.5 15.5002C13.2239 15.5002 13 15.2763 13 15.0002V11.8335C13 11.5574 13.2239 11.3335 13.5 11.3335ZM9.83333 6.3335C9.3731 6.3335 9 6.70659 9 7.16683V8.00016H15V7.16683C15 6.70659 14.6269 6.3335 14.1667 6.3335H9.83333Z", fill: "currentColor" }) });
8
+ function u1() {
9
+ return /* @__PURE__ */ t("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ t("path", { d: "M14.1667 5.3335C15.1792 5.3335 16 6.15431 16 7.16683V8.00016H19C19.2761 8.00016 19.5 8.22402 19.5 8.50016C19.5 8.7763 19.2761 9.00016 19 9.00016H17.3333V16.8335C17.3333 17.846 16.5125 18.6668 15.5 18.6668H8.5C7.48748 18.6668 6.66667 17.846 6.66667 16.8335V9.00016H5C4.72386 9.00016 4.5 8.7763 4.5 8.50016C4.5 8.22402 4.72386 8.00016 5 8.00016H8V7.16683C8 6.15431 8.82081 5.3335 9.83333 5.3335H14.1667ZM7.66667 16.8335C7.66667 17.2937 8.03976 17.6668 8.5 17.6668H15.5C15.9602 17.6668 16.3333 17.2937 16.3333 16.8335V9.00016H7.66667V16.8335ZM10.5 11.3335C10.7761 11.3335 11 11.5574 11 11.8335V15.0002C11 15.2763 10.7761 15.5002 10.5 15.5002C10.2239 15.5002 10 15.2763 10 15.0002V11.8335C10 11.5574 10.2239 11.3335 10.5 11.3335ZM13.5 11.3335C13.7761 11.3335 14 11.5574 14 11.8335V15.0002C14 15.2763 13.7761 15.5002 13.5 15.5002C13.2239 15.5002 13 15.2763 13 15.0002V11.8335C13 11.5574 13.2239 11.3335 13.5 11.3335ZM9.83333 6.3335C9.3731 6.3335 9 6.70659 9 7.16683V8.00016H15V7.16683C15 6.70659 14.6269 6.3335 14.1667 6.3335H9.83333Z", fill: "currentColor" }) });
10
10
  }
11
- function AddIcon() {
12
- return /* @__PURE__ */ jsx("svg", { width: "24", height: "24", viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M515.512889 227.555556a21.070222 21.070222 0 0 1 21.070222 21.070222v245.816889h238.791111a21.070222 21.070222 0 0 1 0 42.140444h-238.791111v238.791111a21.070222 21.070222 0 0 1-42.140444 0v-238.791111H248.625778a21.070222 21.070222 0 0 1 0-42.140444h245.816889V248.625778A21.070222 21.070222 0 0 1 515.512889 227.555556z", fill: "currentColor" }) });
11
+ function s1() {
12
+ return /* @__PURE__ */ t("svg", { width: "24", height: "24", viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ t("path", { d: "M515.512889 227.555556a21.070222 21.070222 0 0 1 21.070222 21.070222v245.816889h238.791111a21.070222 21.070222 0 0 1 0 42.140444h-238.791111v238.791111a21.070222 21.070222 0 0 1-42.140444 0v-238.791111H248.625778a21.070222 21.070222 0 0 1 0-42.140444h245.816889V248.625778A21.070222 21.070222 0 0 1 515.512889 227.555556z", fill: "currentColor" }) });
13
13
  }
14
- function PreviewThinIcon() {
15
- return /* @__PURE__ */ jsxs("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
16
- /* @__PURE__ */ jsx("path", { d: "M8.68576 19.3333C9.0645 19.3333 9.37153 19.6404 9.37153 20.0191V22.1714C9.37153 22.4239 9.5761 22.6285 9.82856 22.6285H11.9809C12.3596 22.6285 12.6667 22.9355 12.6667 23.3142C12.6667 23.693 12.3596 24 11.9809 24H9.82856L9.73438 23.9976C8.79946 23.9502 8.04983 23.2005 8.00239 22.2656L8 22.1714V20.0191C8 19.6404 8.30703 19.3333 8.68576 19.3333Z", fill: "currentColor" }),
17
- /* @__PURE__ */ jsx("path", { d: "M23.3142 19.3333C23.693 19.3333 24 19.6404 24 20.0191V22.1714C24 23.1497 23.2317 23.9486 22.2656 23.9976L22.1714 24H20.0191C19.6404 24 19.3333 23.693 19.3333 23.3142C19.3333 22.9355 19.6404 22.6285 20.0191 22.6285H22.1714C22.4239 22.6285 22.6285 22.4239 22.6285 22.1714V20.0191C22.6285 19.6404 22.9355 19.3333 23.3142 19.3333Z", fill: "currentColor" }),
18
- /* @__PURE__ */ jsx("path", { d: "M15.5573 11.2413C17.8315 11.2989 19.6575 13.1607 19.6576 15.4488L19.656 15.5573C19.6337 16.4372 19.3411 17.2497 18.8585 17.9156L20.5647 19.6217C20.825 19.8821 20.825 20.3043 20.5647 20.5647C20.3043 20.825 19.8823 20.825 19.622 20.5647L17.9156 18.8585C17.2224 19.3609 16.3703 19.6575 15.4488 19.6576L15.3401 19.656C13.102 19.5993 11.298 17.7954 11.2413 15.5573L11.24 15.4488C11.24 13.1244 13.1244 11.24 15.4488 11.24L15.5573 11.2413ZM15.4488 12.5734C13.8608 12.5734 12.5734 13.8608 12.5734 15.4488C12.5734 17.0368 13.8608 18.3242 15.4488 18.3242C17.0368 18.3242 18.3242 17.0368 18.3242 15.4488C18.3242 13.8608 17.0368 12.5734 15.4488 12.5734Z", fill: "currentColor" }),
19
- /* @__PURE__ */ jsx("path", { d: "M11.9809 8C12.3596 8 12.6667 8.30703 12.6667 8.68576C12.6667 9.0645 12.3596 9.37153 11.9809 9.37153H9.82856C9.5761 9.37153 9.37153 9.5761 9.37153 9.82856V11.9809C9.37153 12.3596 9.0645 12.6667 8.68576 12.6667C8.30703 12.6667 8 12.3596 8 11.9809V9.82856C8.00001 8.81868 8.81868 8.00001 9.82856 8H11.9809Z", fill: "currentColor" }),
20
- /* @__PURE__ */ jsx("path", { d: "M22.1714 8C23.1813 8.00001 24 8.81868 24 9.82856V11.9809C24 12.3596 23.693 12.6667 23.3142 12.6667C22.9355 12.6667 22.6285 12.3596 22.6285 11.9809V9.82856C22.6285 9.5761 22.4239 9.37153 22.1714 9.37153H20.0191C19.6404 9.37153 19.3333 9.0645 19.3333 8.68576C19.3333 8.30703 19.6404 8 20.0191 8H22.1714Z", fill: "currentColor" })
14
+ function a1() {
15
+ return /* @__PURE__ */ c("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
16
+ /* @__PURE__ */ t("path", { d: "M8.68576 19.3333C9.0645 19.3333 9.37153 19.6404 9.37153 20.0191V22.1714C9.37153 22.4239 9.5761 22.6285 9.82856 22.6285H11.9809C12.3596 22.6285 12.6667 22.9355 12.6667 23.3142C12.6667 23.693 12.3596 24 11.9809 24H9.82856L9.73438 23.9976C8.79946 23.9502 8.04983 23.2005 8.00239 22.2656L8 22.1714V20.0191C8 19.6404 8.30703 19.3333 8.68576 19.3333Z", fill: "currentColor" }),
17
+ /* @__PURE__ */ t("path", { d: "M23.3142 19.3333C23.693 19.3333 24 19.6404 24 20.0191V22.1714C24 23.1497 23.2317 23.9486 22.2656 23.9976L22.1714 24H20.0191C19.6404 24 19.3333 23.693 19.3333 23.3142C19.3333 22.9355 19.6404 22.6285 20.0191 22.6285H22.1714C22.4239 22.6285 22.6285 22.4239 22.6285 22.1714V20.0191C22.6285 19.6404 22.9355 19.3333 23.3142 19.3333Z", fill: "currentColor" }),
18
+ /* @__PURE__ */ t("path", { d: "M15.5573 11.2413C17.8315 11.2989 19.6575 13.1607 19.6576 15.4488L19.656 15.5573C19.6337 16.4372 19.3411 17.2497 18.8585 17.9156L20.5647 19.6217C20.825 19.8821 20.825 20.3043 20.5647 20.5647C20.3043 20.825 19.8823 20.825 19.622 20.5647L17.9156 18.8585C17.2224 19.3609 16.3703 19.6575 15.4488 19.6576L15.3401 19.656C13.102 19.5993 11.298 17.7954 11.2413 15.5573L11.24 15.4488C11.24 13.1244 13.1244 11.24 15.4488 11.24L15.5573 11.2413ZM15.4488 12.5734C13.8608 12.5734 12.5734 13.8608 12.5734 15.4488C12.5734 17.0368 13.8608 18.3242 15.4488 18.3242C17.0368 18.3242 18.3242 17.0368 18.3242 15.4488C18.3242 13.8608 17.0368 12.5734 15.4488 12.5734Z", fill: "currentColor" }),
19
+ /* @__PURE__ */ t("path", { d: "M11.9809 8C12.3596 8 12.6667 8.30703 12.6667 8.68576C12.6667 9.0645 12.3596 9.37153 11.9809 9.37153H9.82856C9.5761 9.37153 9.37153 9.5761 9.37153 9.82856V11.9809C9.37153 12.3596 9.0645 12.6667 8.68576 12.6667C8.30703 12.6667 8 12.3596 8 11.9809V9.82856C8.00001 8.81868 8.81868 8.00001 9.82856 8H11.9809Z", fill: "currentColor" }),
20
+ /* @__PURE__ */ t("path", { d: "M22.1714 8C23.1813 8.00001 24 8.81868 24 9.82856V11.9809C24 12.3596 23.693 12.6667 23.3142 12.6667C22.9355 12.6667 22.6285 12.3596 22.6285 11.9809V9.82856C22.6285 9.5761 22.4239 9.37153 22.1714 9.37153H20.0191C19.6404 9.37153 19.3333 9.0645 19.3333 8.68576C19.3333 8.30703 19.6404 8 20.0191 8H22.1714Z", fill: "currentColor" })
21
21
  ] });
22
22
  }
23
- function DeleteThinIcon() {
24
- return /* @__PURE__ */ jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M14.1667 5.3335C15.1792 5.3335 16 6.15431 16 7.16683V8.00016H19C19.2761 8.00016 19.5 8.22402 19.5 8.50016C19.5 8.7763 19.2761 9.00016 19 9.00016H17.3333V16.8335C17.3333 17.846 16.5125 18.6668 15.5 18.6668H8.5C7.48748 18.6668 6.66667 17.846 6.66667 16.8335V9.00016H5C4.72386 9.00016 4.5 8.7763 4.5 8.50016C4.5 8.22402 4.72386 8.00016 5 8.00016H8V7.16683C8 6.15431 8.82081 5.3335 9.83333 5.3335H14.1667ZM7.66667 16.8335C7.66667 17.2937 8.03976 17.6668 8.5 17.6668H15.5C15.9602 17.6668 16.3333 17.2937 16.3333 16.8335V9.00016H7.66667V16.8335ZM10.5 11.3335C10.7761 11.3335 11 11.5574 11 11.8335V15.0002C11 15.2763 10.7761 15.5002 10.5 15.5002C10.2239 15.5002 10 15.2763 10 15.0002V11.8335C10 11.5574 10.2239 11.3335 10.5 11.3335ZM13.5 11.3335C13.7761 11.3335 14 11.5574 14 11.8335V15.0002C14 15.2763 13.7761 15.5002 13.5 15.5002C13.2239 15.5002 13 15.2763 13 15.0002V11.8335C13 11.5574 13.2239 11.3335 13.5 11.3335ZM9.83333 6.3335C9.3731 6.3335 9 6.70659 9 7.16683V8.00016H15V7.16683C15 6.70659 14.6269 6.3335 14.1667 6.3335H9.83333Z", fill: "currentColor" }) });
23
+ function d1() {
24
+ return /* @__PURE__ */ t("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ t("path", { d: "M14.1667 5.3335C15.1792 5.3335 16 6.15431 16 7.16683V8.00016H19C19.2761 8.00016 19.5 8.22402 19.5 8.50016C19.5 8.7763 19.2761 9.00016 19 9.00016H17.3333V16.8335C17.3333 17.846 16.5125 18.6668 15.5 18.6668H8.5C7.48748 18.6668 6.66667 17.846 6.66667 16.8335V9.00016H5C4.72386 9.00016 4.5 8.7763 4.5 8.50016C4.5 8.22402 4.72386 8.00016 5 8.00016H8V7.16683C8 6.15431 8.82081 5.3335 9.83333 5.3335H14.1667ZM7.66667 16.8335C7.66667 17.2937 8.03976 17.6668 8.5 17.6668H15.5C15.9602 17.6668 16.3333 17.2937 16.3333 16.8335V9.00016H7.66667V16.8335ZM10.5 11.3335C10.7761 11.3335 11 11.5574 11 11.8335V15.0002C11 15.2763 10.7761 15.5002 10.5 15.5002C10.2239 15.5002 10 15.2763 10 15.0002V11.8335C10 11.5574 10.2239 11.3335 10.5 11.3335ZM13.5 11.3335C13.7761 11.3335 14 11.5574 14 11.8335V15.0002C14 15.2763 13.7761 15.5002 13.5 15.5002C13.2239 15.5002 13 15.2763 13 15.0002V11.8335C13 11.5574 13.2239 11.3335 13.5 11.3335ZM9.83333 6.3335C9.3731 6.3335 9 6.70659 9 7.16683V8.00016H15V7.16683C15 6.70659 14.6269 6.3335 14.1667 6.3335H9.83333Z", fill: "currentColor" }) });
25
25
  }
26
- function defaultFilter(option, input) {
27
- const label = typeof option.label === "string" ? option.label : option.value;
28
- return label.toLowerCase().includes(input.toLowerCase());
26
+ function o1(l, r) {
27
+ return (typeof l.label == "string" ? l.label : l.value).toLowerCase().includes(r.toLowerCase());
29
28
  }
30
- function HighlightText({ text, keyword }) {
31
- if (!keyword) return /* @__PURE__ */ jsx(Fragment, { children: text });
32
- const idx = text.toLowerCase().indexOf(keyword.toLowerCase());
33
- if (idx === -1) return /* @__PURE__ */ jsx(Fragment, { children: text });
34
- const before = text.slice(0, idx);
35
- const match = text.slice(idx, idx + keyword.length);
36
- const after = text.slice(idx + keyword.length);
37
- return /* @__PURE__ */ jsxs(Fragment, { children: [
38
- before,
39
- /* @__PURE__ */ jsx("span", { className: "sku-input-card__dropdown-highlight", children: match }),
40
- after
29
+ function f1({ text: l, keyword: r }) {
30
+ if (!r) return /* @__PURE__ */ t(B, { children: l });
31
+ const n = l.toLowerCase().indexOf(r.toLowerCase());
32
+ if (n === -1) return /* @__PURE__ */ t(B, { children: l });
33
+ const p = l.slice(0, n), C = l.slice(n, n + r.length), a = l.slice(n + r.length);
34
+ return /* @__PURE__ */ c(B, { children: [
35
+ p,
36
+ /* @__PURE__ */ t("span", { className: "sku-input-card__dropdown-highlight", children: C }),
37
+ a
41
38
  ] });
42
39
  }
43
- function SkuInputCard({
44
- id,
45
- name = "",
46
- onNameChange,
47
- mode = "single",
48
- activeLang = "zh",
49
- onLangChange,
50
- showBody = true,
51
- error = false,
52
- onDelete,
53
- onPreviewImage,
54
- onDeleteImage,
55
- onUpload,
56
- onAssociate,
57
- images,
58
- labels,
59
- inputEvents,
60
- className,
61
- style,
62
- options,
63
- optionFilterProp,
64
- onSelect,
65
- onSearch,
66
- open: controlledOpen,
67
- onDropdownVisibleChange
40
+ function m1({
41
+ id: l,
42
+ name: r = "",
43
+ onNameChange: n,
44
+ mode: p = "single",
45
+ activeLang: C = "zh",
46
+ onLangChange: a,
47
+ showBody: W = !0,
48
+ error: O = !1,
49
+ onDelete: q,
50
+ onPreviewImage: H,
51
+ onDeleteImage: w,
52
+ onUpload: j,
53
+ onAssociate: g,
54
+ images: R,
55
+ labels: u,
56
+ inputEvents: G,
57
+ className: J,
58
+ style: K,
59
+ options: _,
60
+ optionFilterProp: E,
61
+ onSelect: M,
62
+ onSearch: V,
63
+ open: N,
64
+ onDropdownVisibleChange: e
68
65
  }) {
69
- const namePlaceholder = (labels == null ? void 0 : labels.namePlaceholder) ?? "请填写产品名称";
70
- const uploadLocalLabel = (labels == null ? void 0 : labels.uploadLocal) ?? "本地上传";
71
- const associateImageLabel = (labels == null ? void 0 : labels.associateImage) ?? "关联图片";
72
- const fileInputRef = useRef(null);
73
- const uploadOptionsRef = useRef(null);
74
- const dropdownRef = useRef(null);
75
- const nameWrapRef = useRef(null);
76
- const [localImages, setLocalImages] = useState([]);
77
- const [showUploadOptions, setShowUploadOptions] = useState(false);
78
- const [internalDropdownOpen, setInternalDropdownOpen] = useState(false);
79
- const [uploading, setUploading] = useState(false);
80
- const hasOptions = Array.isArray(options) && options.length > 0;
81
- const dropdownOpen = controlledOpen !== void 0 ? controlledOpen : hasOptions && internalDropdownOpen;
82
- const filteredOptions = hasOptions ? name ? options.filter(
83
- (o) => optionFilterProp ? optionFilterProp(o, name) : defaultFilter(o, name)
84
- ) : options : [];
85
- useEffect(() => {
86
- if (!showUploadOptions) return;
87
- function handleMouseDown(e) {
88
- if (uploadOptionsRef.current && !uploadOptionsRef.current.contains(e.target)) {
89
- setShowUploadOptions(false);
90
- }
66
+ const Q = (u == null ? void 0 : u.namePlaceholder) ?? "请填写产品名称", X = (u == null ? void 0 : u.uploadLocal) ?? "本地上传", Y = (u == null ? void 0 : u.associateImage) ?? "关联图片", I = v(null), Z = v(null), U = v(null), z = v(null), [P, F] = k([]), [L, h] = k(!1), [S, x] = k(!1), [D, T] = k(!1), y = Array.isArray(_) && _.length > 0, b = N !== void 0 ? N : y && S, $ = y ? r ? _.filter(
67
+ (i) => E ? E(i, r) : o1(i, r)
68
+ ) : _ : [];
69
+ A(() => {
70
+ if (!L) return;
71
+ function i(s) {
72
+ Z.current && !Z.current.contains(s.target) && h(!1);
91
73
  }
92
- document.addEventListener("mousedown", handleMouseDown);
93
- return () => document.removeEventListener("mousedown", handleMouseDown);
94
- }, [showUploadOptions]);
95
- useEffect(() => {
96
- if (!dropdownOpen) return;
97
- function handleMouseDown(e) {
98
- var _a, _b;
99
- const target = e.target;
100
- if (((_a = dropdownRef.current) == null ? void 0 : _a.contains(target)) || ((_b = nameWrapRef.current) == null ? void 0 : _b.contains(target))) {
101
- return;
102
- }
103
- setInternalDropdownOpen(false);
104
- onDropdownVisibleChange == null ? void 0 : onDropdownVisibleChange(false);
74
+ return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
75
+ }, [L]), A(() => {
76
+ if (!b) return;
77
+ function i(s) {
78
+ var o, f;
79
+ const d = s.target;
80
+ (o = U.current) != null && o.contains(d) || (f = z.current) != null && f.contains(d) || (x(!1), e == null || e(!1));
105
81
  }
106
- document.addEventListener("mousedown", handleMouseDown);
107
- return () => document.removeEventListener("mousedown", handleMouseDown);
108
- }, [dropdownOpen, onDropdownVisibleChange]);
109
- const displayImages = images ?? localImages;
110
- async function handleFileChange(e) {
111
- var _a;
112
- const file = (_a = e.target.files) == null ? void 0 : _a[0];
113
- if (!file) return;
114
- e.target.value = "";
115
- setShowUploadOptions(false);
116
- setUploading(true);
117
- try {
118
- if (onUpload) {
119
- const url = await onUpload(file);
120
- if (url && images === void 0) {
121
- setLocalImages((prev) => [...prev, url]);
82
+ return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
83
+ }, [b, e]);
84
+ const m = R ?? P;
85
+ async function t1(i) {
86
+ var d;
87
+ const s = (d = i.target.files) == null ? void 0 : d[0];
88
+ if (s) {
89
+ i.target.value = "", h(!1), T(!0);
90
+ try {
91
+ if (j) {
92
+ const o = await j(s);
93
+ o && R === void 0 && F((f) => [...f, o]);
94
+ } else {
95
+ const o = URL.createObjectURL(s);
96
+ F((f) => [...f, o]);
122
97
  }
123
- } else {
124
- const url = URL.createObjectURL(file);
125
- setLocalImages((prev) => [...prev, url]);
98
+ } finally {
99
+ T(!1);
126
100
  }
127
- } finally {
128
- setUploading(false);
129
101
  }
130
102
  }
131
- function handleLocalUpload() {
132
- var _a;
133
- (_a = fileInputRef.current) == null ? void 0 : _a.click();
103
+ function i1() {
104
+ var i;
105
+ (i = I.current) == null || i.click();
134
106
  }
135
- function handleAssociate() {
136
- setShowUploadOptions(false);
137
- onAssociate == null ? void 0 : onAssociate();
107
+ function r1() {
108
+ h(!1), g == null || g();
138
109
  }
139
- const cardCls = [
110
+ const n1 = [
140
111
  "sku-input-card",
141
- error && "sku-input-card--error",
142
- className
143
- ].filter(Boolean).join(" ");
144
- const inputCls = [
112
+ O && "sku-input-card--error",
113
+ J
114
+ ].filter(Boolean).join(" "), l1 = [
145
115
  "sku-input-card__name-input",
146
- mode === "bilingual" && "sku-input-card__name-input--with-toggle",
147
- error && "sku-input-card__name-input--error"
116
+ p === "bilingual" && "sku-input-card__name-input--with-toggle",
117
+ O && "sku-input-card__name-input--error"
148
118
  ].filter(Boolean).join(" ");
149
- return /* @__PURE__ */ jsxs("div", { className: cardCls, style, children: [
150
- /* @__PURE__ */ jsx("span", { className: "sku-input-card__drag", id, children: /* @__PURE__ */ jsx(DragIcon, {}) }),
151
- /* @__PURE__ */ jsxs("div", { className: "sku-input-card__main", children: [
152
- /* @__PURE__ */ jsxs("div", { className: "sku-input-card__header", children: [
153
- /* @__PURE__ */ jsxs("div", { className: "sku-input-card__name-wrap", ref: nameWrapRef, children: [
154
- /* @__PURE__ */ jsx(
119
+ return /* @__PURE__ */ c("div", { className: n1, style: K, children: [
120
+ /* @__PURE__ */ t("span", { className: "sku-input-card__drag", id: l, children: /* @__PURE__ */ t(e1, {}) }),
121
+ /* @__PURE__ */ c("div", { className: "sku-input-card__main", children: [
122
+ /* @__PURE__ */ c("div", { className: "sku-input-card__header", children: [
123
+ /* @__PURE__ */ c("div", { className: "sku-input-card__name-wrap", ref: z, children: [
124
+ /* @__PURE__ */ t(
155
125
  "input",
156
126
  {
157
- className: inputCls,
158
- value: name,
159
- onChange: (e) => {
160
- onNameChange == null ? void 0 : onNameChange(e.target.value);
161
- onSearch == null ? void 0 : onSearch(e.target.value);
127
+ className: l1,
128
+ value: r,
129
+ onChange: (i) => {
130
+ n == null || n(i.target.value), V == null || V(i.target.value);
162
131
  },
163
132
  onFocus: () => {
164
- if (hasOptions && controlledOpen === void 0) {
165
- setInternalDropdownOpen(true);
166
- onDropdownVisibleChange == null ? void 0 : onDropdownVisibleChange(true);
167
- }
133
+ y && N === void 0 && (x(!0), e == null || e(!0));
168
134
  },
169
- placeholder: namePlaceholder,
170
- ...inputEvents
135
+ placeholder: Q,
136
+ ...G
171
137
  }
172
138
  ),
173
- dropdownOpen && filteredOptions.length > 0 && /* 绝对定位锚定在 name-wrap(position: relative)下方,随输入框跟随滚动/视口变化。
139
+ b && $.length > 0 && /* 绝对定位锚定在 name-wrap(position: relative)下方,随输入框跟随滚动/视口变化。
174
140
  不再用 portal + position:fixed + getBoundingClientRect 定位:iOS 软键盘弹出时
175
141
  fixed 与 getBoundingClientRect 的视口基准不一致,会导致下拉框位置偏移。 */
176
- /* @__PURE__ */ jsx("div", { className: "sku-input-card__dropdown", ref: dropdownRef, children: /* @__PURE__ */ jsx("div", { className: "sku-input-card__dropdown-list", children: filteredOptions.map((opt) => {
177
- const label = typeof opt.label === "string" ? opt.label : opt.value;
178
- return /* @__PURE__ */ jsx(
142
+ /* @__PURE__ */ t("div", { className: "sku-input-card__dropdown", ref: U, children: /* @__PURE__ */ t("div", { className: "sku-input-card__dropdown-list", children: $.map((i) => {
143
+ const s = typeof i.label == "string" ? i.label : i.value;
144
+ return /* @__PURE__ */ t(
179
145
  "div",
180
146
  {
181
147
  className: [
182
148
  "sku-input-card__dropdown-item",
183
- opt.disabled && "sku-input-card__dropdown-item--disabled",
184
- opt.value === name && "sku-input-card__dropdown-item--selected"
149
+ i.disabled && "sku-input-card__dropdown-item--disabled",
150
+ i.value === r && "sku-input-card__dropdown-item--selected"
185
151
  ].filter(Boolean).join(" "),
186
- onMouseDown: (e) => {
187
- e.preventDefault();
188
- if (opt.disabled) return;
189
- onNameChange == null ? void 0 : onNameChange(opt.value);
190
- onSelect == null ? void 0 : onSelect(opt.value, opt);
191
- setInternalDropdownOpen(false);
192
- onDropdownVisibleChange == null ? void 0 : onDropdownVisibleChange(false);
152
+ onMouseDown: (d) => {
153
+ d.preventDefault(), !i.disabled && (n == null || n(i.value), M == null || M(i.value, i), x(!1), e == null || e(!1));
193
154
  },
194
- children: /* @__PURE__ */ jsx(HighlightText, { text: label, keyword: name })
155
+ children: /* @__PURE__ */ t(f1, { text: s, keyword: r })
195
156
  },
196
- opt.value
157
+ i.value
197
158
  );
198
159
  }) }) }),
199
- mode === "bilingual" && /* @__PURE__ */ jsxs("div", { className: "sku-input-card__lang-toggle", children: [
200
- /* @__PURE__ */ jsx(
160
+ p === "bilingual" && /* @__PURE__ */ c("div", { className: "sku-input-card__lang-toggle", children: [
161
+ /* @__PURE__ */ t(
201
162
  "button",
202
163
  {
203
- className: `sku-input-card__lang-btn sku-input-card__lang-btn--${activeLang === "zh" ? "active" : "inactive"}`,
204
- onClick: () => onLangChange == null ? void 0 : onLangChange("zh"),
164
+ className: `sku-input-card__lang-btn sku-input-card__lang-btn--${C === "zh" ? "active" : "inactive"}`,
165
+ onClick: () => a == null ? void 0 : a("zh"),
205
166
  children: "中文"
206
167
  }
207
168
  ),
208
- /* @__PURE__ */ jsx(
169
+ /* @__PURE__ */ t(
209
170
  "button",
210
171
  {
211
- className: `sku-input-card__lang-btn sku-input-card__lang-btn--${activeLang === "en" ? "active" : "inactive"}`,
212
- onClick: () => onLangChange == null ? void 0 : onLangChange("en"),
172
+ className: `sku-input-card__lang-btn sku-input-card__lang-btn--${C === "en" ? "active" : "inactive"}`,
173
+ onClick: () => a == null ? void 0 : a("en"),
213
174
  children: "EN"
214
175
  }
215
176
  )
216
177
  ] })
217
178
  ] }),
218
- /* @__PURE__ */ jsx("button", { className: "sku-input-card__delete", onClick: onDelete, children: /* @__PURE__ */ jsx(DeleteIcon, {}) })
179
+ /* @__PURE__ */ t("button", { className: "sku-input-card__delete", onClick: q, children: /* @__PURE__ */ t(u1, {}) })
219
180
  ] }),
220
- showBody && /* @__PURE__ */ jsxs("div", { className: "sku-input-card__body", children: [
221
- /* @__PURE__ */ jsx(
181
+ W && /* @__PURE__ */ c("div", { className: "sku-input-card__body", children: [
182
+ /* @__PURE__ */ t(
222
183
  "input",
223
184
  {
224
- ref: fileInputRef,
185
+ ref: I,
225
186
  type: "file",
226
187
  accept: "image/jpeg,image/png,image/webp",
227
188
  className: "sku-input-card__file-input",
228
- onChange: handleFileChange
189
+ onChange: t1
229
190
  }
230
191
  ),
231
- uploading ? /* @__PURE__ */ jsx("div", { className: "sku-input-card__loading", children: /* @__PURE__ */ jsx("img", { src: loadingIndicator, alt: "上传中", className: "sku-input-card__loading-img" }) }) : displayImages[0] ? (
192
+ D ? /* @__PURE__ */ t("div", { className: "sku-input-card__loading", children: /* @__PURE__ */ t("img", { src: c1, alt: "上传中", className: "sku-input-card__loading-img" }) }) : m[0] ? (
232
193
  /* Single image preview */
233
- /* @__PURE__ */ jsxs("div", { className: "sku-input-card__image-item", children: [
234
- /* @__PURE__ */ jsx("img", { src: displayImages[0], alt: "图片", className: "sku-input-card__image-thumb" }),
235
- /* @__PURE__ */ jsxs("div", { className: "sku-input-card__image-overlay", children: [
236
- /* @__PURE__ */ jsx(
194
+ /* @__PURE__ */ c("div", { className: "sku-input-card__image-item", children: [
195
+ /* @__PURE__ */ t("img", { src: m[0], alt: "图片", className: "sku-input-card__image-thumb" }),
196
+ /* @__PURE__ */ c("div", { className: "sku-input-card__image-overlay", children: [
197
+ /* @__PURE__ */ t(
237
198
  "button",
238
199
  {
239
200
  className: "sku-input-card__image-action-btn",
240
- onClick: () => onPreviewImage == null ? void 0 : onPreviewImage(displayImages[0]),
241
- children: /* @__PURE__ */ jsx(PreviewThinIcon, {})
201
+ onClick: () => H == null ? void 0 : H(m[0]),
202
+ children: /* @__PURE__ */ t(a1, {})
242
203
  }
243
204
  ),
244
- /* @__PURE__ */ jsx(
205
+ /* @__PURE__ */ t(
245
206
  "button",
246
207
  {
247
208
  className: "sku-input-card__image-action-btn",
248
- onClick: () => onDeleteImage == null ? void 0 : onDeleteImage(displayImages[0]),
249
- children: /* @__PURE__ */ jsx(DeleteThinIcon, {})
209
+ onClick: () => w == null ? void 0 : w(m[0]),
210
+ children: /* @__PURE__ */ t(d1, {})
250
211
  }
251
212
  )
252
213
  ] })
253
214
  ] })
254
- ) : showUploadOptions ? (
215
+ ) : L ? (
255
216
  /* Upload options — local upload / associate image */
256
- /* @__PURE__ */ jsx("div", { className: "sku-input-card__upload-options", children: /* @__PURE__ */ jsxs("div", { ref: uploadOptionsRef, className: "sku-input-card__upload-options-box", children: [
257
- /* @__PURE__ */ jsx("button", { className: "sku-input-card__upload-opt-btn", onClick: handleLocalUpload, children: uploadLocalLabel }),
258
- /* @__PURE__ */ jsx("button", { className: "sku-input-card__upload-opt-btn", onClick: handleAssociate, children: associateImageLabel })
217
+ /* @__PURE__ */ t("div", { className: "sku-input-card__upload-options", children: /* @__PURE__ */ c("div", { ref: Z, className: "sku-input-card__upload-options-box", children: [
218
+ /* @__PURE__ */ t("button", { className: "sku-input-card__upload-opt-btn", onClick: i1, children: X }),
219
+ /* @__PURE__ */ t("button", { className: "sku-input-card__upload-opt-btn", onClick: r1, children: Y })
259
220
  ] }) })
260
221
  ) : (
261
222
  /* Large add button — fills the body */
262
- /* @__PURE__ */ jsx(
223
+ /* @__PURE__ */ t(
263
224
  "button",
264
225
  {
265
226
  className: "sku-input-card__add-btn",
266
- onClick: () => setShowUploadOptions(true),
267
- children: /* @__PURE__ */ jsx(AddIcon, {})
227
+ onClick: () => h(!0),
228
+ children: /* @__PURE__ */ t(s1, {})
268
229
  }
269
230
  )
270
231
  )
@@ -273,5 +234,5 @@ function SkuInputCard({
273
234
  ] });
274
235
  }
275
236
  export {
276
- SkuInputCard as default
237
+ m1 as default
277
238
  };