@plasmicpkgs/antd5 0.0.71 → 0.0.73

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,25 +4087,46 @@ 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),
4094
4097
  defaultValue: props.defaultValue === void 0 ? void 0 : dayjs(props.defaultValue),
4095
- onChange: (value, dateString) => {
4096
- var _a, _b;
4097
- (_a = props.onChange) == null ? void 0 : _a.call(props, value, dateString);
4098
- (_b = props.onChangeIsoString) == null ? void 0 : _b.call(props, value !== null ? value.toISOString() : null);
4098
+ onChange: (value, _dateString) => {
4099
+ var _a;
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
+ }
4099
4109
  }
4100
4110
  })
4101
- );
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
+ ));
4102
4123
  }
4103
4124
  AntdDatePicker.__plasmicFormFieldMeta = { valueProp: "checked" };
4104
4125
  const datePickerComponentName = "plasmic-antd5-date-picker";
4105
4126
  function registerDatePicker(loader) {
4106
4127
  registerComponentHelper(loader, AntdDatePicker, {
4107
4128
  name: datePickerComponentName,
4108
- displayName: "Date Time Picker",
4129
+ displayName: "Date/Time Picker",
4109
4130
  props: {
4110
4131
  value: {
4111
4132
  type: "string",
@@ -4124,7 +4145,7 @@ function registerDatePicker(loader) {
4124
4145
  defaultValueHint: false,
4125
4146
  advanced: true
4126
4147
  },
4127
- onChangeIsoString: {
4148
+ onChange: {
4128
4149
  type: "eventHandler",
4129
4150
  argTypes: [{ name: "value", type: "string" }]
4130
4151
  },
@@ -4182,7 +4203,7 @@ function registerDatePicker(loader) {
4182
4203
  value: {
4183
4204
  type: "writable",
4184
4205
  valueProp: "value",
4185
- onChangeProp: "onChangeIsoString",
4206
+ onChangeProp: "onChange",
4186
4207
  variableType: "text"
4187
4208
  }
4188
4209
  },