@sunggang/ui-lib 0.3.8 → 0.3.10

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.
@@ -66794,7 +66794,7 @@ var BaseCkeditor = function(param) {
66794
66794
  var _item_validateOption;
66795
66795
  var _useFormContext = useFormContext(), control = _useFormContext.control, errors = _useFormContext.formState.errors;
66796
66796
  return /*#__PURE__*/ jsx(Controller, {
66797
- name: item.name,
66797
+ name: item === null || item === void 0 ? void 0 : item.name,
66798
66798
  control: control,
66799
66799
  rules: (item === null || item === void 0 ? void 0 : (_item_validateOption = item.validateOption) === null || _item_validateOption === void 0 ? void 0 : _item_validateOption.required) ? {
66800
66800
  required: item === null || item === void 0 ? void 0 : item.errorText
@@ -66821,8 +66821,18 @@ var BaseCkeditor = function(param) {
66821
66821
  onChange(data);
66822
66822
  },
66823
66823
  onReady: function(editor) {
66824
- if (item === null || item === void 0 ? void 0 : item.disabled) {
66825
- editor.enableReadOnlyMode(item.name);
66824
+ if ((item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)) {
66825
+ editor.enableReadOnlyMode(item === null || item === void 0 ? void 0 : item.name);
66826
+ }
66827
+ var editorElement = editor.ui.view.editable.element;
66828
+ if (editorElement) {
66829
+ editorElement.style.minHeight = (item === null || item === void 0 ? void 0 : item.height) || "200px";
66830
+ editorElement.style.backgroundColor = (item === null || item === void 0 ? void 0 : item.bgColor) || "white";
66831
+ // Focus時高度維持一樣
66832
+ editor.ui.view.editable.on("change:isFocused", function() {
66833
+ editorElement.style.minHeight = (item === null || item === void 0 ? void 0 : item.height) || "200px";
66834
+ editorElement.style.backgroundColor = (item === null || item === void 0 ? void 0 : item.bgColor) || "white";
66835
+ });
66826
66836
  }
66827
66837
  }
66828
66838
  }),
package/index.esm.css CHANGED
@@ -1065,6 +1065,9 @@ video {
1065
1065
  .max-w-xl {
1066
1066
  max-width: 36rem;
1067
1067
  }
1068
+ .flex-1 {
1069
+ flex: 1 1 0%;
1070
+ }
1068
1071
  .flex-none {
1069
1072
  flex: none;
1070
1073
  }
package/index.esm2.js CHANGED
@@ -76886,17 +76886,20 @@ var BaseTemplate = function(param) {
76886
76886
  var imageSource = tempImage || imageUrl;
76887
76887
  var isDisabled = (item === null || item === void 0 ? void 0 : item.disabled) || (item === null || item === void 0 ? void 0 : item.disable);
76888
76888
  return /*#__PURE__*/ jsx("div", {
76889
- className: "max-w-sm mx-auto bg-white rounded-lg shadow-md overflow-hidden items-center",
76889
+ className: "bg-white rounded-lg shadow-md overflow-hidden items-center",
76890
76890
  children: /*#__PURE__*/ jsx("div", {
76891
- className: "px-4 py-6 w-72 h-56",
76891
+ className: "px-4 py-6 h-56",
76892
76892
  children: imageSource ? /*#__PURE__*/ jsx("img", {
76893
- className: "w-full h-full object-contain border-dashed border-2 border-gray-400 p-6 rounded-lg",
76893
+ className: [
76894
+ "w-full h-full object-contain border-dashed border-2 border-gray-400 p-6 rounded-lg",
76895
+ isDisabled ? "opacity-50 cursor-not-allowed" : ""
76896
+ ].join(" "),
76894
76897
  src: imageSource,
76895
76898
  alt: "uploaded or default"
76896
76899
  }) : /*#__PURE__*/ jsx("div", {
76897
76900
  id: "image-preview",
76898
76901
  className: [
76899
- "max-w-sm p-6 bg-gray-100 border-dashed border-2 border-gray-400 rounded-lg items-center mx-auto text-center",
76902
+ "p-6 bg-gray-100 border-dashed border-2 border-gray-400 rounded-lg items-center mx-auto text-center",
76900
76903
  isDisabled ? "opacity-50 cursor-not-allowed" : ""
76901
76904
  ].join(" "),
76902
76905
  children: /*#__PURE__*/ jsxs("div", {
@@ -76978,7 +76981,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
76978
76981
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
76979
76982
  }
76980
76983
  var CustomUpload = function(param) {
76981
- var className = param.className, item = param.item, field = param.field;
76984
+ var item = param.item, field = param.field;
76982
76985
  var imageMimeType = /image\/(png|jpg|jpeg)/i;
76983
76986
  var DEFAULT_IMAGE_SIZE_LIMIT_IN_BYTES = 5120000;
76984
76987
  var _useState = _sliced_to_array$1(useState(null), 2), modal = _useState[0], setModal = _useState[1];
@@ -77018,15 +77021,14 @@ var CustomUpload = function(param) {
77018
77021
  field.onChange(currentFile);
77019
77022
  };
77020
77023
  var previewUrl = _instanceof(field.value, File) ? URL.createObjectURL(field.value) : typeof field.value === "string" ? field.value : null;
77021
- return /*#__PURE__*/ jsxs("div", {
77022
- className: [
77023
- "w-fit",
77024
- className
77025
- ].join(" "),
77024
+ return /*#__PURE__*/ jsxs(Fragment$1, {
77026
77025
  children: [
77027
77026
  /*#__PURE__*/ jsx("div", {
77028
77027
  className: "mb-2",
77029
77028
  children: /*#__PURE__*/ jsxs("button", {
77029
+ className: [
77030
+ (item === null || item === void 0 ? void 0 : item.className) || "w-full"
77031
+ ].join(" "),
77030
77032
  type: "button",
77031
77033
  onClick: handleImageClick,
77032
77034
  children: [
@@ -77046,7 +77048,7 @@ var CustomUpload = function(param) {
77046
77048
  ]
77047
77049
  })
77048
77050
  }),
77049
- field.value && /*#__PURE__*/ jsx("button", {
77051
+ !(item === null || item === void 0 ? void 0 : item.hiddenIcon) && field.value && /*#__PURE__*/ jsx("button", {
77050
77052
  type: "button",
77051
77053
  className: "w-6 h-6 text-[#000]",
77052
77054
  onClick: function() {
@@ -77744,7 +77746,7 @@ var CustomUploadField = function(param) {
77744
77746
  var field = param.field, fieldState = param.fieldState;
77745
77747
  var _fieldState_error;
77746
77748
  return /*#__PURE__*/ jsxs("div", {
77747
- className: "flex flex-col gap-1",
77749
+ className: "flex flex-1 flex-col gap-1",
77748
77750
  children: [
77749
77751
  (item === null || item === void 0 ? void 0 : item.label) && /*#__PURE__*/ jsx("label", {
77750
77752
  className: "font-medium",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunggang/ui-lib",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "dependencies": {
5
5
  "@emotion/react": "^11.14.0",
6
6
  "@emotion/styled": "^11.14.0",
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  interface CustomUploadProps {
3
- className?: string;
4
3
  item: any;
5
4
  field: any;
6
5
  }
@@ -49,6 +49,7 @@ export interface FormItem {
49
49
  icon?: string;
50
50
  option?: Options;
51
51
  hiddenArrow?: boolean;
52
+ hiddenIcon?: boolean;
52
53
  radioOptions?: RadioOption[];
53
54
  direction?: 'horizontal' | 'vertical';
54
55
  step?: string;
@@ -70,6 +71,8 @@ export interface FormItem {
70
71
  fieldName?: string;
71
72
  authToken?: string;
72
73
  };
74
+ height?: string;
75
+ bgColor?: string;
73
76
  disabled?: boolean;
74
77
  }
75
78
  export interface FormType {