easy-email-pro-theme 1.59.1 → 1.59.2

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/lib/index.js CHANGED
@@ -29268,7 +29268,8 @@ const NewColorPicker$1 = (props) => {
29268
29268
  onBlur: _onBlur,
29269
29269
  showInput: _showInput,
29270
29270
  placeholder: _placeholder,
29271
- getPopupContainer
29271
+ getPopupContainer,
29272
+ allowClear = true
29272
29273
  } = _a, arcoColorPickerProps = __objRest(_a, [
29273
29274
  "value",
29274
29275
  "onChange",
@@ -29276,7 +29277,8 @@ const NewColorPicker$1 = (props) => {
29276
29277
  "onBlur",
29277
29278
  "showInput",
29278
29279
  "placeholder",
29279
- "getPopupContainer"
29280
+ "getPopupContainer",
29281
+ "allowClear"
29280
29282
  ]);
29281
29283
  const [popupVisible, setPopupVisible] = useState(false);
29282
29284
  const wasPopupVisibleRef = useRef(false);
@@ -29329,6 +29331,13 @@ const NewColorPicker$1 = (props) => {
29329
29331
  setPickerValue(value2);
29330
29332
  debouncedApplyPickerChange(value2);
29331
29333
  });
29334
+ const onClear = useEventCallback((event) => {
29335
+ event.stopPropagation();
29336
+ debouncedApplyPickerChange.cancel();
29337
+ setPickerValue("");
29338
+ setPopupVisible(false);
29339
+ onChange == null ? void 0 : onChange("");
29340
+ });
29332
29341
  const onVisibleChange = useEventCallback((visible) => {
29333
29342
  if (!visible && wasPopupVisibleRef.current) {
29334
29343
  debouncedApplyPickerChange.flush();
@@ -29345,7 +29354,8 @@ const NewColorPicker$1 = (props) => {
29345
29354
  window.removeEventListener(CustomEvent.EDITOR_CLICK, onHandle);
29346
29355
  };
29347
29356
  }, [onVisibleChange]);
29348
- return /* @__PURE__ */ React__default.createElement(ArcoColorPickerConfigProvider, null, /* @__PURE__ */ React__default.createElement(
29357
+ const showClearButton = allowClear && !arcoColorPickerProps.disabled && Boolean(value || pickerValue);
29358
+ return /* @__PURE__ */ React__default.createElement(ArcoColorPickerConfigProvider, null, /* @__PURE__ */ React__default.createElement("div", { style: { display: "flex", alignItems: "center", width: "100%" } }, /* @__PURE__ */ React__default.createElement(
29349
29359
  ColorPicker$2,
29350
29360
  __spreadProps(__spreadValues({}, arcoColorPickerProps), {
29351
29361
  value: pickerValue,
@@ -29366,7 +29376,17 @@ const NewColorPicker$1 = (props) => {
29366
29376
  ].filter(Boolean).join(" ")
29367
29377
  })
29368
29378
  })
29369
- ));
29379
+ ), showClearButton ? /* @__PURE__ */ React__default.createElement(
29380
+ Button$2,
29381
+ {
29382
+ "aria-label": "Clear color",
29383
+ icon: /* @__PURE__ */ React__default.createElement(IconClose, null),
29384
+ onClick: onClear,
29385
+ size: "mini",
29386
+ type: "text",
29387
+ style: { marginLeft: 4, flex: "none" }
29388
+ }
29389
+ ) : null));
29370
29390
  };
29371
29391
  const ColorPickerContainer = (props) => {
29372
29392
  var _b;
@@ -9,5 +9,6 @@ export interface NewColorPickerProps extends Omit<ArcoColorPickerProps, "onChang
9
9
  showInput?: boolean;
10
10
  placeholder?: string;
11
11
  getPopupContainer?: (node: HTMLElement) => HTMLElement;
12
+ allowClear?: boolean;
12
13
  }
13
14
  export declare const NewColorPicker: (props: NewColorPickerProps) => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-email-pro-theme",
3
- "version": "1.59.1",
3
+ "version": "1.59.2",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib"