@plasmicpkgs/antd5 0.0.72 → 0.0.74

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/antd.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import React, { isValidElement, cloneElement } from 'react';
1
+ import React, { isValidElement, cloneElement, useState } from 'react';
2
2
  import { Button, Checkbox, ConfigProvider, theme, message, notification, Menu, Dropdown, Input, InputNumber, Radio, Select, Switch, Form, DatePicker, Modal, Table, Upload } from 'antd';
3
3
  import registerComponent from '@plasmicapp/host/registerComponent';
4
4
  import registerGlobalContext from '@plasmicapp/host/registerGlobalContext';
@@ -4087,7 +4087,10 @@ var __spreadValues = (a, b) => {
4087
4087
  };
4088
4088
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
4089
4089
  function AntdDatePicker(props) {
4090
- return /* @__PURE__ */ React.createElement(
4090
+ const nativeInput = React.useRef(null);
4091
+ const [open, setOpen] = useState(false);
4092
+ const strValue = props.value && !(typeof props.value === "string") && "toISOString" in props.value ? props.value.toISOString() : props.value === null ? void 0 : props.value;
4093
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
4091
4094
  DatePicker,
4092
4095
  __spreadProps(__spreadValues({}, props), {
4093
4096
  value: props.value === void 0 ? void 0 : !props.value ? null : dayjs(props.value),
@@ -4095,9 +4098,28 @@ function AntdDatePicker(props) {
4095
4098
  onChange: (value, _dateString) => {
4096
4099
  var _a;
4097
4100
  (_a = props.onChange) == null ? void 0 : _a.call(props, value !== null ? value.toISOString() : null);
4101
+ },
4102
+ open,
4103
+ onOpenChange: (open2) => {
4104
+ if (open2 && window.innerWidth < 500) {
4105
+ nativeInput.current.showPicker();
4106
+ } else {
4107
+ setOpen(open2);
4108
+ }
4098
4109
  }
4099
4110
  })
4100
- );
4111
+ ), /* @__PURE__ */ React.createElement(
4112
+ "input",
4113
+ {
4114
+ hidden: true,
4115
+ ref: nativeInput,
4116
+ type: props.showTime ? "datetime-local" : "date",
4117
+ value: strValue,
4118
+ onChange: (e) => {
4119
+ props.onChange(e.target.value);
4120
+ }
4121
+ }
4122
+ ));
4101
4123
  }
4102
4124
  AntdDatePicker.__plasmicFormFieldMeta = { valueProp: "checked" };
4103
4125
  const datePickerComponentName = "plasmic-antd5-date-picker";