@plasmicpkgs/antd5 0.0.29 → 0.0.30

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
@@ -3,7 +3,7 @@ import registerComponent from '@plasmicapp/host/registerComponent';
3
3
  import registerGlobalContext from '@plasmicapp/host/registerGlobalContext';
4
4
  import Checkbox from 'antd/es/checkbox';
5
5
  import CheckboxGroup from 'antd/es/checkbox/Group';
6
- import React from 'react';
6
+ import React, { isValidElement, cloneElement } from 'react';
7
7
  import { GlobalActionsProvider, usePlasmicCanvasContext, DataProvider, repeatedElement } from '@plasmicapp/host';
8
8
  import registerToken from '@plasmicapp/host/registerToken';
9
9
  import { addLoadingStateListener } from '@plasmicapp/query';
@@ -14,10 +14,11 @@ import useNotification from 'antd/es/notification/useNotification';
14
14
  import theme from 'antd/es/theme';
15
15
  import Dropdown from 'antd/es/dropdown';
16
16
  import Menu from 'antd/es/menu';
17
- import Form from 'antd/lib/form';
18
- import FormItem from 'antd/lib/form/FormItem';
19
- import FormList from 'antd/lib/form/FormList';
17
+ import Form from 'antd/es/form';
18
+ import FormItem from 'antd/es/form/FormItem';
19
+ import FormList from 'antd/es/form/FormList';
20
20
  import equal from 'fast-deep-equal';
21
+ import classNames from 'classnames';
21
22
  import Input from 'antd/es/input';
22
23
  import InputNumber from 'antd/es/input-number';
23
24
  import Modal from 'antd/es/modal';
@@ -139,6 +140,10 @@ function registerButton(loader) {
139
140
  icon: {
140
141
  type: "slot",
141
142
  hidePlaceholder: true
143
+ },
144
+ onClick: {
145
+ type: "eventHandler",
146
+ argTypes: []
142
147
  }
143
148
  },
144
149
  importPath: "@plasmicpkgs/antd5/skinny/registerButton",
@@ -146,39 +151,39 @@ function registerButton(loader) {
146
151
  });
147
152
  }
148
153
 
149
- var __defProp$7 = Object.defineProperty;
154
+ var __defProp$8 = Object.defineProperty;
150
155
  var __defProps$7 = Object.defineProperties;
151
156
  var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
152
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
153
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
154
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
155
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
156
- var __spreadValues$7 = (a, b) => {
157
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
158
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
159
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
160
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
161
+ var __spreadValues$8 = (a, b) => {
157
162
  for (var prop in b || (b = {}))
158
- if (__hasOwnProp$7.call(b, prop))
159
- __defNormalProp$7(a, prop, b[prop]);
160
- if (__getOwnPropSymbols$7)
161
- for (var prop of __getOwnPropSymbols$7(b)) {
162
- if (__propIsEnum$7.call(b, prop))
163
- __defNormalProp$7(a, prop, b[prop]);
163
+ if (__hasOwnProp$8.call(b, prop))
164
+ __defNormalProp$8(a, prop, b[prop]);
165
+ if (__getOwnPropSymbols$8)
166
+ for (var prop of __getOwnPropSymbols$8(b)) {
167
+ if (__propIsEnum$8.call(b, prop))
168
+ __defNormalProp$8(a, prop, b[prop]);
164
169
  }
165
170
  return a;
166
171
  };
167
172
  var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
168
- var __objRest$5 = (source, exclude) => {
173
+ var __objRest$6 = (source, exclude) => {
169
174
  var target = {};
170
175
  for (var prop in source)
171
- if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
176
+ if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
172
177
  target[prop] = source[prop];
173
- if (source != null && __getOwnPropSymbols$7)
174
- for (var prop of __getOwnPropSymbols$7(source)) {
175
- if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
178
+ if (source != null && __getOwnPropSymbols$8)
179
+ for (var prop of __getOwnPropSymbols$8(source)) {
180
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
176
181
  target[prop] = source[prop];
177
182
  }
178
183
  return target;
179
184
  };
180
185
  function AntdCheckbox(props) {
181
- const _a = props, { onChange } = _a, rest = __objRest$5(_a, ["onChange"]);
186
+ const _a = props, { onChange } = _a, rest = __objRest$6(_a, ["onChange"]);
182
187
  const wrappedOnChange = React.useMemo(() => {
183
188
  if (onChange) {
184
189
  return (event) => onChange(event.target.checked);
@@ -186,7 +191,7 @@ function AntdCheckbox(props) {
186
191
  return void 0;
187
192
  }
188
193
  }, [onChange]);
189
- return /* @__PURE__ */ React.createElement(Checkbox, __spreadProps$7(__spreadValues$7({}, rest), {
194
+ return /* @__PURE__ */ React.createElement(Checkbox, __spreadProps$7(__spreadValues$8({}, rest), {
190
195
  onChange: wrappedOnChange
191
196
  }));
192
197
  }
@@ -297,33 +302,33 @@ function registerCheckbox(loader) {
297
302
  });
298
303
  }
299
304
 
300
- var __defProp$6 = Object.defineProperty;
305
+ var __defProp$7 = Object.defineProperty;
301
306
  var __defProps$6 = Object.defineProperties;
302
307
  var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
303
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
304
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
305
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
306
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
307
- var __spreadValues$6 = (a, b) => {
308
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
309
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
310
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
311
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
312
+ var __spreadValues$7 = (a, b) => {
308
313
  for (var prop in b || (b = {}))
309
- if (__hasOwnProp$6.call(b, prop))
310
- __defNormalProp$6(a, prop, b[prop]);
311
- if (__getOwnPropSymbols$6)
312
- for (var prop of __getOwnPropSymbols$6(b)) {
313
- if (__propIsEnum$6.call(b, prop))
314
- __defNormalProp$6(a, prop, b[prop]);
314
+ if (__hasOwnProp$7.call(b, prop))
315
+ __defNormalProp$7(a, prop, b[prop]);
316
+ if (__getOwnPropSymbols$7)
317
+ for (var prop of __getOwnPropSymbols$7(b)) {
318
+ if (__propIsEnum$7.call(b, prop))
319
+ __defNormalProp$7(a, prop, b[prop]);
315
320
  }
316
321
  return a;
317
322
  };
318
323
  var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
319
- var __objRest$4 = (source, exclude) => {
324
+ var __objRest$5 = (source, exclude) => {
320
325
  var target = {};
321
326
  for (var prop in source)
322
- if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
327
+ if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
323
328
  target[prop] = source[prop];
324
- if (source != null && __getOwnPropSymbols$6)
325
- for (var prop of __getOwnPropSymbols$6(source)) {
326
- if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
329
+ if (source != null && __getOwnPropSymbols$7)
330
+ for (var prop of __getOwnPropSymbols$7(source)) {
331
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
327
332
  target[prop] = source[prop];
328
333
  }
329
334
  return target;
@@ -345,7 +350,7 @@ function themeToAntdConfig(opts) {
345
350
  wireframe,
346
351
  spacing
347
352
  } = opts;
348
- return __spreadProps$6(__spreadValues$6({}, spacing && { size: spacing }), {
353
+ return __spreadProps$6(__spreadValues$7({}, spacing && { size: spacing }), {
349
354
  theme: {
350
355
  token: Object.fromEntries(Object.entries({
351
356
  colorTextBase,
@@ -366,10 +371,10 @@ function themeToAntdConfig(opts) {
366
371
  });
367
372
  }
368
373
  function AntdConfigProvider(props) {
369
- const _a = props, { children, themeStyles } = _a, rest = __objRest$4(_a, ["children", "themeStyles"]);
370
- return /* @__PURE__ */ React.createElement(ConfigProvider, __spreadValues$6({
374
+ const _a = props, { children, themeStyles } = _a, rest = __objRest$5(_a, ["children", "themeStyles"]);
375
+ return /* @__PURE__ */ React.createElement(ConfigProvider, __spreadValues$7({
371
376
  locale: enUS
372
- }, themeToAntdConfig(__spreadProps$6(__spreadValues$6({}, rest), {
377
+ }, themeToAntdConfig(__spreadProps$6(__spreadValues$7({}, rest), {
373
378
  fontFamily: themeStyles.fontFamily,
374
379
  fontSize: themeStyles.fontSize ? parseInt(themeStyles.fontSize) : void 0,
375
380
  lineHeight: themeStyles.lineHeight ? parseInt(themeStyles.lineHeight) : void 0,
@@ -389,8 +394,8 @@ function InnerConfigProvider(props) {
389
394
  const actions = React.useMemo(() => ({
390
395
  showNotification: (opts) => {
391
396
  var _b;
392
- const _a = opts, rest = __objRest$4(_a, ["type"]);
393
- app.notification[(_b = opts.type) != null ? _b : "info"](__spreadValues$6({}, rest));
397
+ const _a = opts, rest = __objRest$5(_a, ["type"]);
398
+ app.notification[(_b = opts.type) != null ? _b : "info"](__spreadValues$7({}, rest));
394
399
  },
395
400
  hideNotifications: () => {
396
401
  app.notification.destroy();
@@ -459,7 +464,8 @@ function registerTokens(loader) {
459
464
  const colorIndex = name.indexOf("color");
460
465
  const humanName = makeNiceName(colorIndex >= 0 ? name.substring(name.indexOf("color") + "color".length) : name);
461
466
  return {
462
- name: `Sys: ${humanName}`,
467
+ name,
468
+ displayName: `System: ${humanName}`,
463
469
  value: `var(--antd-${name})`,
464
470
  type: "color"
465
471
  };
@@ -646,7 +652,7 @@ function registerTokens(loader) {
646
652
  regs.forEach((t) => registerToken(t));
647
653
  }
648
654
  }
649
- const registerConfigProvider = makeRegisterGlobalContext(AntdConfigProvider, __spreadProps$6(__spreadValues$6({
655
+ const registerConfigProvider = makeRegisterGlobalContext(AntdConfigProvider, __spreadProps$6(__spreadValues$7({
650
656
  name: "plasmic-antd5-config-provider",
651
657
  displayName: "Ant Design System Settings",
652
658
  props: {
@@ -751,40 +757,40 @@ const registerConfigProvider = makeRegisterGlobalContext(AntdConfigProvider, __s
751
757
  importName: "AntdConfigProvider"
752
758
  }));
753
759
 
754
- var __defProp$5 = Object.defineProperty;
760
+ var __defProp$6 = Object.defineProperty;
755
761
  var __defProps$5 = Object.defineProperties;
756
762
  var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
757
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
758
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
759
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
760
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
761
- var __spreadValues$5 = (a, b) => {
763
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
764
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
765
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
766
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
767
+ var __spreadValues$6 = (a, b) => {
762
768
  for (var prop in b || (b = {}))
763
- if (__hasOwnProp$5.call(b, prop))
764
- __defNormalProp$5(a, prop, b[prop]);
765
- if (__getOwnPropSymbols$5)
766
- for (var prop of __getOwnPropSymbols$5(b)) {
767
- if (__propIsEnum$5.call(b, prop))
768
- __defNormalProp$5(a, prop, b[prop]);
769
+ if (__hasOwnProp$6.call(b, prop))
770
+ __defNormalProp$6(a, prop, b[prop]);
771
+ if (__getOwnPropSymbols$6)
772
+ for (var prop of __getOwnPropSymbols$6(b)) {
773
+ if (__propIsEnum$6.call(b, prop))
774
+ __defNormalProp$6(a, prop, b[prop]);
769
775
  }
770
776
  return a;
771
777
  };
772
778
  var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
773
- var __objRest$3 = (source, exclude) => {
779
+ var __objRest$4 = (source, exclude) => {
774
780
  var target = {};
775
781
  for (var prop in source)
776
- if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
782
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
777
783
  target[prop] = source[prop];
778
- if (source != null && __getOwnPropSymbols$5)
779
- for (var prop of __getOwnPropSymbols$5(source)) {
780
- if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
784
+ if (source != null && __getOwnPropSymbols$6)
785
+ for (var prop of __getOwnPropSymbols$6(source)) {
786
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
781
787
  target[prop] = source[prop];
782
788
  }
783
789
  return target;
784
790
  };
785
791
  function AntdDropdown(props) {
786
- const _a = props, { children, onAction, menuItems } = _a, rest = __objRest$3(_a, ["children", "onAction", "menuItems"]);
787
- return /* @__PURE__ */ React.createElement(Dropdown, __spreadProps$5(__spreadValues$5({}, rest), {
792
+ const _a = props, { children, onAction, menuItems } = _a, rest = __objRest$4(_a, ["children", "onAction", "menuItems"]);
793
+ return /* @__PURE__ */ React.createElement(Dropdown, __spreadProps$5(__spreadValues$6({}, rest), {
788
794
  overlay: () => {
789
795
  var _a2;
790
796
  const items = (_a2 = menuItems == null ? void 0 : menuItems()) != null ? _a2 : [];
@@ -888,6 +894,87 @@ function registerDropdown(loader) {
888
894
  });
889
895
  }
890
896
 
897
+ var __defProp$5 = Object.defineProperty;
898
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
899
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
900
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
901
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
902
+ var __spreadValues$5 = (a, b) => {
903
+ for (var prop in b || (b = {}))
904
+ if (__hasOwnProp$5.call(b, prop))
905
+ __defNormalProp$5(a, prop, b[prop]);
906
+ if (__getOwnPropSymbols$5)
907
+ for (var prop of __getOwnPropSymbols$5(b)) {
908
+ if (__propIsEnum$5.call(b, prop))
909
+ __defNormalProp$5(a, prop, b[prop]);
910
+ }
911
+ return a;
912
+ };
913
+ const isBrowser = typeof window !== "undefined";
914
+ const NONE = Symbol("NONE");
915
+ isBrowser ? React.useLayoutEffect : React.useEffect;
916
+ function mergeProps(props, ...restProps) {
917
+ if (restProps.every((rest) => Object.keys(rest).length === 0)) {
918
+ return props;
919
+ }
920
+ const result = __spreadValues$5({}, props);
921
+ for (const rest of restProps) {
922
+ for (const key of Object.keys(rest)) {
923
+ result[key] = mergePropVals(key, result[key], rest[key]);
924
+ }
925
+ }
926
+ return result;
927
+ }
928
+ function updateRef(ref, value) {
929
+ if (!ref) {
930
+ return;
931
+ }
932
+ if (typeof ref === "function") {
933
+ ref(value);
934
+ } else {
935
+ if (!Object.isFrozen(ref)) {
936
+ ref.current = value;
937
+ }
938
+ }
939
+ }
940
+ function mergeRefs(...refs) {
941
+ return (value) => {
942
+ for (const ref of refs) {
943
+ updateRef(ref, value);
944
+ }
945
+ };
946
+ }
947
+ function mergePropVals(name, val1, val2) {
948
+ if (val1 === NONE || val2 === NONE) {
949
+ return null;
950
+ } else if (val1 == null) {
951
+ return val2;
952
+ } else if (val2 == null) {
953
+ return val1;
954
+ } else if (name === "className") {
955
+ return classNames(val1, val2);
956
+ } else if (name === "style") {
957
+ return __spreadValues$5(__spreadValues$5({}, val1), val2);
958
+ } else if (name === "ref") {
959
+ return mergeRefs(val1, val2);
960
+ } else if (typeof val1 !== typeof val2) {
961
+ return val2;
962
+ } else if (name.startsWith("on") && typeof val1 === "function") {
963
+ return (...args) => {
964
+ let res;
965
+ if (typeof val1 === "function") {
966
+ res = val1(...args);
967
+ }
968
+ if (typeof val2 === "function") {
969
+ res = val2(...args);
970
+ }
971
+ return res;
972
+ };
973
+ } else {
974
+ return val2;
975
+ }
976
+ }
977
+
891
978
  var __defProp$4 = Object.defineProperty;
892
979
  var __defProps$4 = Object.defineProperties;
893
980
  var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
@@ -907,18 +994,31 @@ var __spreadValues$4 = (a, b) => {
907
994
  return a;
908
995
  };
909
996
  var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
997
+ var __objRest$3 = (source, exclude) => {
998
+ var target = {};
999
+ for (var prop in source)
1000
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
1001
+ target[prop] = source[prop];
1002
+ if (source != null && __getOwnPropSymbols$4)
1003
+ for (var prop of __getOwnPropSymbols$4(source)) {
1004
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
1005
+ target[prop] = source[prop];
1006
+ }
1007
+ return target;
1008
+ };
910
1009
  const PathContext = React.createContext({ relativePath: [], fullPath: [] });
911
1010
  const InternalFormInstanceContext = React.createContext(void 0);
912
1011
  const Internal = (props) => {
1012
+ var _a, _b;
913
1013
  const [form] = Form.useForm();
914
1014
  const values = form.getFieldsValue(true);
915
1015
  const lastValue = React.useRef(values);
916
1016
  const childrenNode = typeof props.children === "function" ? props.children(values, form) : props.children;
917
1017
  const fireOnValuesChange = () => {
918
- var _a;
1018
+ var _a2;
919
1019
  const values2 = form.getFieldsValue(true);
920
1020
  if (!equal(values2, lastValue.current)) {
921
- (_a = props.extendedOnValuesChange) == null ? void 0 : _a.call(props, values2);
1021
+ (_a2 = props.extendedOnValuesChange) == null ? void 0 : _a2.call(props, values2);
922
1022
  lastValue.current = values2;
923
1023
  }
924
1024
  };
@@ -928,15 +1028,18 @@ const Internal = (props) => {
928
1028
  return /* @__PURE__ */ React.createElement(InternalFormInstanceContext.Provider, {
929
1029
  value: {
930
1030
  fireOnValuesChange,
931
- forceRemount: () => props.setRemountKey((k) => k + 1)
1031
+ forceRemount: () => props.setRemountKey((k) => k + 1),
1032
+ formProps: props
932
1033
  }
933
1034
  }, /* @__PURE__ */ React.createElement(Form, __spreadProps$4(__spreadValues$4({}, props), {
934
1035
  onValuesChange: (...args) => {
935
- var _a, _b;
936
- (_a = props.onValuesChange) == null ? void 0 : _a.call(props, ...args);
937
- (_b = props.extendedOnValuesChange) == null ? void 0 : _b.call(props, args[1]);
1036
+ var _a2, _b2;
1037
+ (_a2 = props.onValuesChange) == null ? void 0 : _a2.call(props, ...args);
1038
+ (_b2 = props.extendedOnValuesChange) == null ? void 0 : _b2.call(props, args[1]);
938
1039
  },
939
- form
1040
+ form,
1041
+ labelCol: ((_a = props.labelCol) == null ? void 0 : _a.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.labelCol,
1042
+ wrapperCol: ((_b = props.wrapperCol) == null ? void 0 : _b.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.wrapperCol
940
1043
  }), childrenNode));
941
1044
  };
942
1045
  function FormWrapper(props) {
@@ -950,7 +1053,7 @@ function FormWrapper(props) {
950
1053
  const COMMON_ACTIONS = [
951
1054
  {
952
1055
  type: "button-action",
953
- label: "Append new Form.Item",
1056
+ label: "Append new Form Item",
954
1057
  onClick: ({ studioOps }) => {
955
1058
  studioOps.appendToSlot({
956
1059
  type: "component",
@@ -960,7 +1063,7 @@ const COMMON_ACTIONS = [
960
1063
  },
961
1064
  {
962
1065
  type: "button-action",
963
- label: "Append new Form.Group",
1066
+ label: "Append new Form Group",
964
1067
  onClick: ({ studioOps }) => {
965
1068
  studioOps.appendToSlot({
966
1069
  type: "component",
@@ -970,7 +1073,7 @@ const COMMON_ACTIONS = [
970
1073
  },
971
1074
  {
972
1075
  type: "button-action",
973
- label: "Append new Form.List",
1076
+ label: "Append new Form List",
974
1077
  onClick: ({ studioOps }) => {
975
1078
  studioOps.appendToSlot({
976
1079
  type: "component",
@@ -980,6 +1083,33 @@ const COMMON_ACTIONS = [
980
1083
  }
981
1084
  ];
982
1085
  function registerForm(loader) {
1086
+ const colProp = (displayName, defaultValue) => ({
1087
+ type: "object",
1088
+ displayName,
1089
+ advanced: true,
1090
+ fields: {
1091
+ span: {
1092
+ type: "number",
1093
+ displayName: "Grid columns",
1094
+ description: "The number of grid columns to span (24 columns available)",
1095
+ min: 1,
1096
+ max: 24
1097
+ },
1098
+ offset: {
1099
+ type: "number",
1100
+ displayName: "Offset columns",
1101
+ description: "Number of grid columns to skip from the left",
1102
+ min: 0,
1103
+ max: 23
1104
+ },
1105
+ horizontalOnly: {
1106
+ type: "boolean",
1107
+ displayName: "Horizontal only",
1108
+ description: "Only apply to horizontal layout"
1109
+ }
1110
+ },
1111
+ defaultValue
1112
+ });
983
1113
  registerComponentHelper(loader, FormWrapper, {
984
1114
  name: "plasmic-antd5-form",
985
1115
  displayName: "Form",
@@ -989,11 +1119,33 @@ function registerForm(loader) {
989
1119
  defaultValue: [
990
1120
  {
991
1121
  type: "component",
992
- name: "plasmic-antd5-form-item"
1122
+ name: "plasmic-antd5-form-item",
1123
+ props: {
1124
+ label: {
1125
+ type: "text",
1126
+ value: "Name"
1127
+ },
1128
+ name: "name",
1129
+ children: {
1130
+ type: "component",
1131
+ name: "plasmic-antd5-input"
1132
+ }
1133
+ }
993
1134
  },
994
1135
  {
995
1136
  type: "component",
996
- name: "plasmic-antd5-form-item"
1137
+ name: "plasmic-antd5-form-item",
1138
+ props: {
1139
+ label: {
1140
+ type: "text",
1141
+ value: "Message"
1142
+ },
1143
+ name: "message",
1144
+ children: {
1145
+ type: "component",
1146
+ name: "plasmic-antd5-textarea"
1147
+ }
1148
+ }
997
1149
  },
998
1150
  {
999
1151
  type: "default-component",
@@ -1015,21 +1167,51 @@ function registerForm(loader) {
1015
1167
  layout: {
1016
1168
  type: "choice",
1017
1169
  options: ["horizontal", "vertical", "inline"],
1018
- defaultValue: "horizontal"
1170
+ defaultValue: "vertical"
1171
+ },
1172
+ labelAlign: {
1173
+ type: "choice",
1174
+ options: ["left", "right"],
1175
+ defaultValueHint: "right",
1176
+ advanced: true
1019
1177
  },
1178
+ labelCol: colProp("Label layout", {
1179
+ span: 8,
1180
+ horizontalOnly: true
1181
+ }),
1182
+ wrapperCol: colProp("Field layout", {
1183
+ span: 16,
1184
+ horizontalOnly: true
1185
+ }),
1020
1186
  colon: {
1021
1187
  type: "boolean",
1022
- description: `Configure the default value of colon for Form.Item. Indicates whether the colon after the label is displayed (only effective when prop layout is horizontal)`,
1023
- defaultValue: true,
1188
+ description: `Show a colon after the label by default (only for horizontal layout)`,
1189
+ defaultValueHint: true,
1024
1190
  advanced: true
1025
1191
  },
1026
1192
  requiredMark: {
1027
- displayName: "Show required fields?",
1028
- type: "boolean",
1029
- advanced: true
1193
+ displayName: "Required/optional mark",
1194
+ type: "choice",
1195
+ options: [
1196
+ {
1197
+ value: "optional",
1198
+ label: "Indicate optional fields"
1199
+ },
1200
+ {
1201
+ value: true,
1202
+ label: "Indicate required fields with asterisk"
1203
+ },
1204
+ {
1205
+ value: false,
1206
+ label: "Show no indicators"
1207
+ }
1208
+ ],
1209
+ advanced: true,
1210
+ defaultValueHint: true
1030
1211
  },
1031
1212
  extendedOnValuesChange: {
1032
1213
  type: "eventHandler",
1214
+ displayName: "On values change",
1033
1215
  argTypes: [
1034
1216
  {
1035
1217
  name: "changedValues",
@@ -1043,6 +1225,7 @@ function registerForm(loader) {
1043
1225
  },
1044
1226
  onFinish: {
1045
1227
  type: "eventHandler",
1228
+ displayName: "On submit",
1046
1229
  argTypes: [
1047
1230
  {
1048
1231
  name: "values",
@@ -1052,6 +1235,7 @@ function registerForm(loader) {
1052
1235
  },
1053
1236
  onFinishFailed: {
1054
1237
  type: "eventHandler",
1238
+ displayName: "On invalid submit",
1055
1239
  argTypes: [
1056
1240
  {
1057
1241
  name: "data",
@@ -1061,9 +1245,9 @@ function registerForm(loader) {
1061
1245
  },
1062
1246
  validateTrigger: {
1063
1247
  type: "choice",
1064
- options: ["onSubmit", "onChange"],
1248
+ options: ["onSubmit", "onChange", "onBlur"],
1065
1249
  multiSelect: true,
1066
- defaultValue: ["onChange"],
1250
+ defaultValueHint: ["onChange"],
1067
1251
  advanced: true
1068
1252
  }
1069
1253
  },
@@ -1131,40 +1315,68 @@ const useFormItemFullName = (name) => {
1131
1315
  const pathCtx = React.useContext(PathContext);
1132
1316
  return typeof name === "object" ? [...pathCtx.fullPath, ...name] : typeof name === "string" ? [...pathCtx.fullPath, name] : void 0;
1133
1317
  };
1318
+ function useFormInstanceMaybe() {
1319
+ return Form.useFormInstance();
1320
+ }
1134
1321
  function FormItemWrapper(props) {
1135
- var _a;
1322
+ var _a, _b;
1136
1323
  const relativeFormItemName = useFormItemRelativeName(props.name);
1137
1324
  const fullFormItemName = useFormItemFullName(props.name);
1138
1325
  const rules = props.rules ? plasmicRulesToAntdRules(props.rules) : void 0;
1139
1326
  const inCanvas = !!usePlasmicCanvasContext();
1140
1327
  if (inCanvas) {
1141
- const form = Form.useFormInstance();
1328
+ const form = useFormInstanceMaybe();
1142
1329
  const prevPropValues = React.useRef({
1143
1330
  initialValue: props.initialValue,
1144
1331
  name: props.name
1145
1332
  });
1146
- const { fireOnValuesChange, forceRemount } = (_a = React.useContext(InternalFormInstanceContext)) != null ? _a : {};
1333
+ const internalFormCtx = React.useContext(InternalFormInstanceContext);
1334
+ const { fireOnValuesChange, forceRemount } = internalFormCtx != null ? internalFormCtx : {};
1335
+ (_a = props.setControlContextData) == null ? void 0 : _a.call(props, {
1336
+ internalFormCtx
1337
+ });
1147
1338
  React.useEffect(() => {
1148
1339
  if (prevPropValues.current.name !== props.name) {
1149
1340
  forceRemount == null ? void 0 : forceRemount();
1150
1341
  }
1151
- if (!fullFormItemName || form.getFieldValue(fullFormItemName) !== prevPropValues.current.initialValue) {
1342
+ if (!fullFormItemName || (form == null ? void 0 : form.getFieldValue(fullFormItemName)) !== prevPropValues.current.initialValue) {
1152
1343
  return;
1153
1344
  }
1154
- form.setFieldValue(fullFormItemName, props.initialValue);
1345
+ form == null ? void 0 : form.setFieldValue(fullFormItemName, props.initialValue);
1155
1346
  prevPropValues.current.initialValue = props.initialValue;
1156
1347
  fireOnValuesChange == null ? void 0 : fireOnValuesChange();
1157
- }, [props.initialValue, fullFormItemName]);
1348
+ }, [form, props.initialValue, fullFormItemName]);
1158
1349
  }
1159
- return /* @__PURE__ */ React.createElement(FormItem, __spreadProps$4(__spreadValues$4({}, omit(props, "rules")), {
1350
+ return /* @__PURE__ */ React.createElement(FormItem, __spreadValues$4(__spreadProps$4(__spreadValues$4({}, omit(props, "rules")), {
1351
+ label: props.noLabel ? void 0 : props.label,
1160
1352
  name: relativeFormItemName,
1161
1353
  rules
1162
- }));
1354
+ }), props.helpTextMode === "extra" ? { extra: props.help } : props.helpTextMode === "help" ? { help: (_b = props.help) != null ? _b : "" } : {}), props.customizeProps ? /* @__PURE__ */ React.createElement(FormItemForwarder, {
1355
+ formItemProps: props
1356
+ }) : props.children);
1357
+ }
1358
+ function FormItemForwarder(_a) {
1359
+ var _b = _a, { formItemProps } = _b, props = __objRest$3(_b, ["formItemProps"]);
1360
+ var _a2;
1361
+ const status = Form.Item.useStatus();
1362
+ const internalFormCtx = React.useContext(InternalFormInstanceContext);
1363
+ const data = {
1364
+ status: status.status
1365
+ };
1366
+ (_a2 = props.setControlContextData) == null ? void 0 : _a2.call(props, {
1367
+ internalFormCtx,
1368
+ status
1369
+ });
1370
+ return React.Children.map(formItemProps.children, (child, i) => {
1371
+ var _a3;
1372
+ const baseProps = __spreadValues$4(__spreadValues$4({}, (_a3 = child.props) != null ? _a3 : {}), props);
1373
+ return i === 0 && isValidElement(child) ? cloneElement(child, mergeProps(baseProps, formItemProps.customizeProps(data, baseProps))) : child;
1374
+ });
1163
1375
  }
1164
1376
  function registerFormItem(loader) {
1165
1377
  registerComponentHelper(loader, FormItemWrapper, {
1166
1378
  name: "plasmic-antd5-form-item",
1167
- displayName: "Form.Item",
1379
+ displayName: "Form Item",
1168
1380
  parentComponentName: "plasmic-antd5-form",
1169
1381
  props: {
1170
1382
  label: {
@@ -1191,12 +1403,18 @@ function registerFormItem(loader) {
1191
1403
  type: "boolean"
1192
1404
  },
1193
1405
  rules: {
1194
- type: "formValidationRules",
1195
- displayName: "rules"
1406
+ type: "formValidationRules"
1407
+ },
1408
+ noLabel: {
1409
+ type: "boolean",
1410
+ advanced: true
1196
1411
  },
1197
1412
  colon: {
1198
1413
  type: "boolean",
1199
- defaultValue: false,
1414
+ defaultValueHint: (_ps, ctx) => {
1415
+ var _a, _b;
1416
+ return (_b = (_a = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _a.formProps.colon) != null ? _b : true;
1417
+ },
1200
1418
  advanced: true
1201
1419
  },
1202
1420
  labelAlign: {
@@ -1207,6 +1425,66 @@ function registerFormItem(loader) {
1207
1425
  hidden: {
1208
1426
  type: "boolean",
1209
1427
  advanced: true
1428
+ },
1429
+ validateTrigger: {
1430
+ type: "choice",
1431
+ options: ["onSubmit", "onChange", "onBlur"],
1432
+ multiSelect: true,
1433
+ advanced: true
1434
+ },
1435
+ shouldUpdate: {
1436
+ type: "boolean",
1437
+ advanced: true,
1438
+ displayName: "Always re-render",
1439
+ description: "Form items normally only re-render when the corresponding form value changes, for performance. This forces it to always re-render."
1440
+ },
1441
+ helpTextMode: {
1442
+ type: "choice",
1443
+ displayName: "Help text",
1444
+ options: [
1445
+ {
1446
+ value: "errors",
1447
+ label: "Validation errors"
1448
+ },
1449
+ {
1450
+ value: "extra",
1451
+ label: "Custom help text and validation errors"
1452
+ },
1453
+ {
1454
+ value: "help",
1455
+ label: "Custom help text, no validation errors"
1456
+ }
1457
+ ],
1458
+ defaultValueHint: "Show validation errors",
1459
+ description: "What to show in the help text. Edit help text by editing the 'help' slot in the outline."
1460
+ },
1461
+ help: {
1462
+ type: "slot",
1463
+ hidden: (ps) => {
1464
+ var _a;
1465
+ return !["extra", "help"].includes((_a = ps.helpTextMode) != null ? _a : "");
1466
+ },
1467
+ hidePlaceholder: true
1468
+ },
1469
+ customizeProps: {
1470
+ type: "function",
1471
+ description: "Customize the props passed into the wrapped field component. Takes the current status ('success', 'warning', 'error', or 'validating').)",
1472
+ argNames: ["fieldData"],
1473
+ argValues: (_ps, ctx) => {
1474
+ var _a;
1475
+ return [
1476
+ {
1477
+ status: (_a = ctx == null ? void 0 : ctx.status) == null ? void 0 : _a.status
1478
+ }
1479
+ ];
1480
+ },
1481
+ advanced: true
1482
+ },
1483
+ noStyle: {
1484
+ type: "boolean",
1485
+ displayName: "Field only",
1486
+ description: "Don't render anything but the wrapped field component - so no label, help text, validation error, etc.",
1487
+ advanced: true
1210
1488
  }
1211
1489
  },
1212
1490
  importPath: "@plasmicpkgs/antd5/skinny/registerForm",
@@ -1225,7 +1503,7 @@ function FormGroup(props) {
1225
1503
  function registerFormGroup(loader) {
1226
1504
  registerComponentHelper(loader, FormGroup, {
1227
1505
  name: "plasmic-antd5-form-group",
1228
- displayName: "Form.Group",
1506
+ displayName: "Form Group",
1229
1507
  parentComponentName: "plasmic-antd5-form",
1230
1508
  actions: COMMON_ACTIONS,
1231
1509
  props: {
@@ -1267,7 +1545,7 @@ const FormListWrapper = React.forwardRef(function FormListWrapper2(props, ref) {
1267
1545
  }), [operationsRef]);
1268
1546
  const inCanvas = !!usePlasmicCanvasContext();
1269
1547
  if (inCanvas) {
1270
- const form = Form.useFormInstance();
1548
+ const form = useFormInstanceMaybe();
1271
1549
  const prevPropValues = React.useRef({
1272
1550
  initialValue: props.initialValue,
1273
1551
  name: props.name
@@ -1278,7 +1556,7 @@ const FormListWrapper = React.forwardRef(function FormListWrapper2(props, ref) {
1278
1556
  forceRemount == null ? void 0 : forceRemount();
1279
1557
  }
1280
1558
  if (fullFormItemName) {
1281
- form.setFieldValue(fullFormItemName, props.initialValue);
1559
+ form == null ? void 0 : form.setFieldValue(fullFormItemName, props.initialValue);
1282
1560
  prevPropValues.current.initialValue = props.initialValue;
1283
1561
  fireOnValuesChange == null ? void 0 : fireOnValuesChange();
1284
1562
  }
@@ -1306,33 +1584,63 @@ function registerFormList(loader) {
1306
1584
  registerComponentHelper(loader, FormListWrapper, {
1307
1585
  name: "plasmic-antd5-form-list",
1308
1586
  parentComponentName: "plasmic-antd5-form",
1309
- displayName: "Form.List",
1587
+ displayName: "Form List",
1310
1588
  actions: COMMON_ACTIONS,
1311
1589
  props: {
1312
1590
  children: {
1313
1591
  type: "slot",
1314
1592
  defaultValue: [
1315
1593
  {
1316
- type: "component",
1317
- name: "plasmic-antd5-form-item",
1318
- props: {
1319
- name: "item"
1320
- }
1594
+ type: "hbox",
1595
+ children: [
1596
+ {
1597
+ type: "component",
1598
+ name: "plasmic-antd5-form-item",
1599
+ props: {
1600
+ name: "firstName",
1601
+ label: {
1602
+ type: "text",
1603
+ value: "First name"
1604
+ },
1605
+ children: {
1606
+ type: "component",
1607
+ name: "plasmic-antd5-input"
1608
+ }
1609
+ }
1610
+ },
1611
+ {
1612
+ type: "component",
1613
+ name: "plasmic-antd5-form-item",
1614
+ props: {
1615
+ name: "lastName",
1616
+ label: {
1617
+ type: "text",
1618
+ value: "Last name"
1619
+ },
1620
+ children: {
1621
+ type: "component",
1622
+ name: "plasmic-antd5-input"
1623
+ }
1624
+ }
1625
+ }
1626
+ ]
1321
1627
  }
1322
1628
  ]
1323
1629
  },
1324
1630
  name: {
1325
1631
  type: "string",
1326
- defaultValue: "list"
1632
+ defaultValue: "guests"
1327
1633
  },
1328
1634
  initialValue: {
1329
- type: "object",
1635
+ type: "array",
1330
1636
  defaultValue: [
1331
1637
  {
1332
- item: "Item 1"
1638
+ firstName: "Jane",
1639
+ lastName: "Doe"
1333
1640
  },
1334
1641
  {
1335
- item: "Item 2"
1642
+ firstName: "John",
1643
+ lastName: "Smith"
1336
1644
  }
1337
1645
  ]
1338
1646
  }
@@ -1629,6 +1937,12 @@ const AntdMenuDivider = Menu.Divider;
1629
1937
  const AntdMenuItem = Menu.Item;
1630
1938
  const AntdMenuItemGroup = Menu.ItemGroup;
1631
1939
  const AntdSubMenu = Menu.SubMenu;
1940
+ const allowedMenuComponents = [
1941
+ "plasmic-antd5-menu-item",
1942
+ "plasmic-antd5-menu-divider",
1943
+ "plasmic-antd5-submenu",
1944
+ "plasmic-antd5-menu-item-group"
1945
+ ];
1632
1946
  function registerMenu(loader) {
1633
1947
  registerComponentHelper(loader, AntdMenu, {
1634
1948
  name: "plasmic-antd5-menu",
@@ -1658,20 +1972,21 @@ function registerMenu(loader) {
1658
1972
  },
1659
1973
  children: {
1660
1974
  type: "slot",
1661
- allowedComponents: [
1662
- "plasmic-antd5-menu-item",
1663
- "plasmic-antd5-menu-divider",
1664
- "plasmic-antd5-submenu",
1665
- "plasmic-antd5-menu-group"
1666
- ],
1975
+ allowedComponents: allowedMenuComponents,
1667
1976
  defaultValue: [
1668
1977
  {
1669
1978
  type: "component",
1670
- name: "plasmic-antd5-menu-item"
1979
+ name: "plasmic-antd5-menu-item",
1980
+ props: {
1981
+ key: "menuItemKey1"
1982
+ }
1671
1983
  },
1672
1984
  {
1673
1985
  type: "component",
1674
- name: "plasmic-antd5-menu-item"
1986
+ name: "plasmic-antd5-menu-item",
1987
+ props: {
1988
+ key: "menuItemKey2"
1989
+ }
1675
1990
  }
1676
1991
  ]
1677
1992
  },
@@ -1699,7 +2014,8 @@ function registerMenu(loader) {
1699
2014
  },
1700
2015
  key: {
1701
2016
  type: "string",
1702
- description: "Unique ID of the menu item",
2017
+ displayName: "Unique key",
2018
+ description: "Unique ID of the menu item. Used to determine which item is selected.",
1703
2019
  defaultValue: "menuItemKey"
1704
2020
  },
1705
2021
  title: {
@@ -1711,9 +2027,13 @@ function registerMenu(loader) {
1711
2027
  defaultValue: [
1712
2028
  {
1713
2029
  type: "text",
1714
- value: "Option"
2030
+ value: "Menu item"
1715
2031
  }
1716
2032
  ]
2033
+ },
2034
+ onClick: {
2035
+ type: "eventHandler",
2036
+ argTypes: []
1717
2037
  }
1718
2038
  },
1719
2039
  importPath: "@plasmicpkgs/antd5/skinny/registerMenu",
@@ -1735,12 +2055,7 @@ function registerMenu(loader) {
1735
2055
  },
1736
2056
  children: {
1737
2057
  type: "slot",
1738
- allowedComponents: [
1739
- "plasmic-antd5-menu-item",
1740
- "plasmic-antd5-menu-divider",
1741
- "plasmic-antd5-menu-item-group",
1742
- "plasmic-antd5-submenu"
1743
- ],
2058
+ allowedComponents: allowedMenuComponents,
1744
2059
  defaultValue: [
1745
2060
  {
1746
2061
  type: "component",
@@ -1778,7 +2093,8 @@ function registerMenu(loader) {
1778
2093
  },
1779
2094
  key: {
1780
2095
  type: "string",
1781
- description: "Unique ID of the sub-menu",
2096
+ displayName: "Unique key",
2097
+ description: "Unique ID of the sub-menu. Used to determine which item is selected.",
1782
2098
  advanced: true
1783
2099
  },
1784
2100
  title: {
@@ -1792,12 +2108,7 @@ function registerMenu(loader) {
1792
2108
  },
1793
2109
  children: {
1794
2110
  type: "slot",
1795
- allowedComponents: [
1796
- "plasmic-antd5-menu-item",
1797
- "plasmic-antd5-menu-divider",
1798
- "plasmic-antd5-menu-item-group",
1799
- "plasmic-antd5-submenu"
1800
- ],
2111
+ allowedComponents: allowedMenuComponents,
1801
2112
  defaultValue: [1, 2].map((i) => ({
1802
2113
  type: "component",
1803
2114
  name: "plasmic-antd5-menu-item",
@@ -2165,21 +2476,28 @@ var __objRest = (source, exclude) => {
2165
2476
  return target;
2166
2477
  };
2167
2478
  const AntdOption = Select.Option;
2479
+ const AntdOptionGroup = Select.OptGroup;
2168
2480
  function AntdSelect(props) {
2169
2481
  const _a = props, {
2170
2482
  popupClassName,
2171
2483
  popupScopeClassName,
2172
2484
  defaultStylesClassName,
2173
2485
  suffixIcon,
2174
- mode
2486
+ mode,
2487
+ useChildren
2175
2488
  } = _a, rest = __objRest(_a, [
2176
2489
  "popupClassName",
2177
2490
  "popupScopeClassName",
2178
2491
  "defaultStylesClassName",
2179
2492
  "suffixIcon",
2180
- "mode"
2493
+ "mode",
2494
+ "useChildren"
2181
2495
  ]);
2182
- return /* @__PURE__ */ React.createElement(Select, __spreadValues(__spreadProps(__spreadValues({}, rest), {
2496
+ const curated = __spreadValues({}, rest);
2497
+ if (useChildren) {
2498
+ curated.options = void 0;
2499
+ }
2500
+ return /* @__PURE__ */ React.createElement(Select, __spreadValues(__spreadProps(__spreadValues({}, curated), {
2183
2501
  mode: !mode || mode === "single" ? void 0 : mode,
2184
2502
  popupClassName: `${defaultStylesClassName} ${popupScopeClassName} ${popupClassName}`
2185
2503
  }), suffixIcon && { suffixIcon }));
@@ -2189,9 +2507,41 @@ function registerSelect(loader) {
2189
2507
  name: "plasmic-antd5-select",
2190
2508
  displayName: "Select",
2191
2509
  props: {
2510
+ options: {
2511
+ type: "array",
2512
+ hidden: (ps) => !!ps.useChildren,
2513
+ itemType: {
2514
+ type: "object",
2515
+ nameFunc: (item) => item.label,
2516
+ fields: {
2517
+ value: "string",
2518
+ label: "string"
2519
+ }
2520
+ },
2521
+ defaultValue: [
2522
+ {
2523
+ value: "option1",
2524
+ label: "Option 1"
2525
+ },
2526
+ {
2527
+ value: "option2",
2528
+ label: "Option 2"
2529
+ }
2530
+ ]
2531
+ },
2532
+ useChildren: {
2533
+ displayName: "Use slot",
2534
+ type: "boolean",
2535
+ defaultValueHint: false,
2536
+ description: "Instead of configuring a list of options, customize the contents of the Select by dragging and dropping options in the outline/canvas, inside the 'children' slot. Lets you use any content or formatting within the Options, and also use Option Groups."
2537
+ },
2192
2538
  children: {
2193
2539
  type: "slot",
2194
- allowedComponents: ["AntdOption"]
2540
+ allowedComponents: [
2541
+ "plasmic-antd5-option",
2542
+ "plasmic-antd5-option-group"
2543
+ ],
2544
+ hidden: (ps) => !ps.useChildren
2195
2545
  },
2196
2546
  placeholder: {
2197
2547
  type: "slot",
@@ -2214,13 +2564,24 @@ function registerSelect(loader) {
2214
2564
  description: "Initial selected option",
2215
2565
  multiSelect: (ps) => ps.mode === "multiple",
2216
2566
  options: (ps) => {
2567
+ var _a;
2217
2568
  const options = /* @__PURE__ */ new Set();
2218
- traverseReactEltTree(ps.children, (elt) => {
2219
- var _a;
2220
- if ((elt == null ? void 0 : elt.type) === Select.Option && typeof ((_a = elt == null ? void 0 : elt.props) == null ? void 0 : _a.value) === "string") {
2221
- options.add(elt.props.value);
2222
- }
2223
- });
2569
+ if (!ps.useChildren) {
2570
+ return ((_a = ps.options) != null ? _a : []).map((o) => {
2571
+ var _a2;
2572
+ return {
2573
+ value: o.value || "",
2574
+ label: (_a2 = o.label) != null ? _a2 : o.value || ""
2575
+ };
2576
+ });
2577
+ } else {
2578
+ traverseReactEltTree(ps.children, (elt) => {
2579
+ var _a2;
2580
+ if ((elt == null ? void 0 : elt.type) === Select.Option && typeof ((_a2 = elt == null ? void 0 : elt.props) == null ? void 0 : _a2.value) === "string") {
2581
+ options.add(elt.props.value);
2582
+ }
2583
+ });
2584
+ }
2224
2585
  return Array.from(options.keys());
2225
2586
  }
2226
2587
  },
@@ -2363,6 +2724,46 @@ function registerSelect(loader) {
2363
2724
  importPath: "@plasmicpkgs/antd5/skinny/registerSelect",
2364
2725
  importName: "AntdOption"
2365
2726
  });
2727
+ registerComponentHelper(loader, AntdOptionGroup, {
2728
+ name: "plasmic-antd5-option-group",
2729
+ displayName: "Option Group",
2730
+ parentComponentName: "plasmic-antd5-select",
2731
+ props: {
2732
+ children: {
2733
+ type: "slot",
2734
+ defaultValue: [
2735
+ {
2736
+ type: "component",
2737
+ name: "plasmic-antd5-option",
2738
+ props: {
2739
+ value: "option1",
2740
+ children: {
2741
+ type: "text",
2742
+ value: "Option 1"
2743
+ }
2744
+ }
2745
+ },
2746
+ {
2747
+ type: "component",
2748
+ name: "plasmic-antd5-option",
2749
+ props: {
2750
+ value: "option2",
2751
+ children: {
2752
+ type: "text",
2753
+ value: "Option 1"
2754
+ }
2755
+ }
2756
+ }
2757
+ ]
2758
+ },
2759
+ label: {
2760
+ type: "slot",
2761
+ defaultValue: "Group label"
2762
+ }
2763
+ },
2764
+ importPath: "@plasmicpkgs/antd5/skinny/registerSelect",
2765
+ importName: "AntdOptionGroup"
2766
+ });
2366
2767
  }
2367
2768
 
2368
2769
  function registerAll(loader) {