@plasmicpkgs/antd 2.0.19 → 2.0.21

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.
Files changed (79) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/antd.esm.js +703 -616
  3. package/dist/antd.esm.js.map +1 -1
  4. package/dist/customControls.d.ts +17 -17
  5. package/dist/index.d.ts +16 -16
  6. package/dist/index.js +2352 -5
  7. package/dist/index.js.map +1 -0
  8. package/dist/registerButton.d.ts +5 -5
  9. package/dist/registerCarousel.d.ts +5 -5
  10. package/dist/registerCheckbox.d.ts +8 -8
  11. package/dist/registerCollapse.d.ts +14 -14
  12. package/dist/registerDropdown.d.ts +11 -11
  13. package/dist/registerInput.d.ts +14 -14
  14. package/dist/registerMenu.d.ts +15 -15
  15. package/dist/registerOption.d.ts +8 -8
  16. package/dist/registerRate.d.ts +5 -5
  17. package/dist/registerSelect.d.ts +8 -8
  18. package/dist/registerSlider.d.ts +19 -19
  19. package/dist/registerSwitch.d.ts +5 -5
  20. package/dist/registerTable.d.ts +30 -30
  21. package/dist/registerTabs.d.ts +14 -13
  22. package/dist/registerable.d.ts +4 -4
  23. package/package.json +10 -9
  24. package/skinny/customControls-fb0b7e5f.js +22 -0
  25. package/skinny/{customControls-ff79afdf.js.map → customControls-fb0b7e5f.js.map} +1 -1
  26. package/skinny/customControls.d.ts +17 -17
  27. package/skinny/registerButton.d.ts +5 -5
  28. package/skinny/registerButton.js +80 -81
  29. package/skinny/registerButton.js.map +1 -1
  30. package/skinny/registerCarousel.d.ts +5 -5
  31. package/skinny/registerCarousel.js +66 -67
  32. package/skinny/registerCarousel.js.map +1 -1
  33. package/skinny/registerCheckbox.d.ts +8 -8
  34. package/skinny/registerCheckbox.js +125 -121
  35. package/skinny/registerCheckbox.js.map +1 -1
  36. package/skinny/registerCollapse.d.ts +14 -14
  37. package/skinny/registerCollapse.js +174 -153
  38. package/skinny/registerCollapse.js.map +1 -1
  39. package/skinny/registerDropdown.d.ts +11 -11
  40. package/skinny/registerDropdown.js +175 -171
  41. package/skinny/registerDropdown.js.map +1 -1
  42. package/skinny/registerInput.d.ts +14 -14
  43. package/skinny/registerInput.js +362 -312
  44. package/skinny/registerInput.js.map +1 -1
  45. package/skinny/registerMenu.d.ts +15 -15
  46. package/skinny/registerMenu.js +275 -298
  47. package/skinny/registerMenu.js.map +1 -1
  48. package/skinny/registerOption.d.ts +8 -8
  49. package/skinny/registerOption.js +73 -81
  50. package/skinny/registerOption.js.map +1 -1
  51. package/skinny/registerRate.d.ts +5 -5
  52. package/skinny/registerRate.js +66 -0
  53. package/skinny/registerRate.js.map +1 -0
  54. package/skinny/registerSelect.d.ts +8 -8
  55. package/skinny/registerSelect.js +129 -130
  56. package/skinny/registerSelect.js.map +1 -1
  57. package/skinny/registerSlider.d.ts +19 -19
  58. package/skinny/registerSlider.js +132 -104
  59. package/skinny/registerSlider.js.map +1 -1
  60. package/skinny/registerSwitch.d.ts +5 -5
  61. package/skinny/registerSwitch.js +55 -56
  62. package/skinny/registerSwitch.js.map +1 -1
  63. package/skinny/registerTable.d.ts +30 -30
  64. package/skinny/registerTable.js +202 -183
  65. package/skinny/registerTable.js.map +1 -1
  66. package/skinny/registerTabs.d.ts +14 -13
  67. package/skinny/registerTabs.js +344 -311
  68. package/skinny/registerTabs.js.map +1 -1
  69. package/skinny/registerable.d.ts +4 -4
  70. package/skinny/registerable.js +3 -0
  71. package/skinny/registerable.js.map +1 -0
  72. package/dist/antd.cjs.development.js +0 -2243
  73. package/dist/antd.cjs.development.js.map +0 -1
  74. package/dist/antd.cjs.production.min.js +0 -2
  75. package/dist/antd.cjs.production.min.js.map +0 -1
  76. package/skinny/customControls-ff79afdf.js +0 -27
  77. package/skinny/index.d.ts +0 -16
  78. package/skinny/tslib.es6-b92c4a81.js +0 -59
  79. package/skinny/tslib.es6-b92c4a81.js.map +0 -1
@@ -1,323 +1,356 @@
1
1
  'use strict';
2
2
 
3
- var tslib_es6 = require('./tslib.es6-b92c4a81.js');
4
3
  var registerComponent = require('@plasmicapp/host/registerComponent');
5
4
  var antd = require('antd');
6
5
  var AntdTabs = require('antd/lib/tabs');
7
- var rcTabs = require('rc-tabs');
8
6
  var React = require('react');
9
- var customControls = require('./customControls-ff79afdf.js');
7
+ var customControls = require('./customControls-fb0b7e5f.js');
10
8
 
11
- var tabPaneMeta = {
12
- name: "AntdTabPane",
13
- displayName: "Antd Tab Pane",
14
- props: {
15
- tab: {
16
- type: "slot",
17
- defaultValue: [
18
- {
19
- type: "text",
20
- value: "Tab",
21
- },
22
- ],
23
- },
24
- key: {
25
- type: "string",
26
- description: "Unique TabPane's key",
27
- defaultValue: "tabPaneKey",
28
- },
29
- closable: {
30
- type: "boolean",
31
- description: "Wether the tab can be closed or not. Only works for editable tabs",
32
- defaultValueHint: true,
33
- },
34
- disabled: {
35
- type: "boolean",
36
- description: "Disabled state of tab",
37
- defaultValueHint: false,
38
- },
39
- forceRender: {
40
- type: "boolean",
41
- description: "Forced render of content in tabs, not lazy render after clicking on tabs",
42
- defaultValueHint: false,
43
- },
44
- closeIcon: {
45
- type: "slot",
46
- hidePlaceholder: true,
47
- },
48
- children: {
49
- type: "slot",
50
- defaultValue: [
51
- {
52
- type: "text",
53
- value: "Tab Content",
54
- },
55
- ],
56
- },
57
- },
58
- parentComponentName: "AntdTabs",
59
- importPath: "rc-tabs",
60
- importName: "TabPane",
61
- };
62
- function registerTabPane(loader, customTabPaneMeta) {
63
- var doRegisterComponent = function () {
64
- var args = [];
65
- for (var _i = 0; _i < arguments.length; _i++) {
66
- args[_i] = arguments[_i];
67
- }
68
- return loader ? loader.registerComponent.apply(loader, args) : registerComponent.apply(void 0, args);
69
- };
70
- doRegisterComponent(rcTabs.TabPane, customTabPaneMeta !== null && customTabPaneMeta !== void 0 ? customTabPaneMeta : tabPaneMeta);
71
- }
72
- function Tabs(props) {
73
- var leftTabBarExtraContent = props.leftTabBarExtraContent, rightTabBarExtraContent = props.rightTabBarExtraContent, otherProps = tslib_es6.__rest(props, ["leftTabBarExtraContent", "rightTabBarExtraContent"]);
74
- return (React.createElement(AntdTabs, tslib_es6.__assign({}, otherProps, { tabBarExtraContent: {
75
- left: leftTabBarExtraContent,
76
- right: rightTabBarExtraContent,
77
- } })));
78
- }
79
- function NavigateTabs(_a) {
80
- var componentProps = _a.componentProps, studioOps = _a.studioOps;
81
- var tabPanes = [];
82
- customControls.traverseReactEltTree(componentProps.children, function (elt) {
83
- if ((elt === null || elt === void 0 ? void 0 : elt.type) === rcTabs.TabPane && typeof (elt === null || elt === void 0 ? void 0 : elt.key) === "string") {
84
- tabPanes.push(elt.key);
85
- }
86
- });
87
- var activeKey = componentProps.activeKey;
88
- var currTabPos = activeKey
89
- ? tabPanes.findIndex(function (tabKey) {
90
- return tabKey === activeKey;
91
- })
92
- : 0;
93
- return (React.createElement("div", { style: {
94
- width: "100%",
95
- display: "flex",
96
- flexDirection: "row",
97
- gap: "10px",
98
- justifyContent: "space-between",
99
- } },
100
- React.createElement(antd.Button, { style: { width: "100%" }, onClick: function () {
101
- if (tabPanes.length > 0) {
102
- var prevTabPos = (currTabPos - 1 + tabPanes.length) % tabPanes.length;
103
- studioOps.updateProps({ activeKey: tabPanes[prevTabPos] });
104
- }
105
- } }, "Prev tab"),
106
- React.createElement(antd.Button, { style: { width: "100%" }, onClick: function () {
107
- if (tabPanes.length > 0) {
108
- var nextTabPos = (currTabPos + 1) % tabPanes.length;
109
- studioOps.updateProps({ activeKey: tabPanes[nextTabPos] });
110
- }
111
- } }, "Next tab")));
112
- }
113
- function OutlineMessage() {
114
- return React.createElement("div", null, "* To re-arrange tab panes, use the Outline panel");
115
- }
116
- var tabsMeta = {
117
- name: "AntdTabs",
118
- displayName: "Antd Tabs",
119
- props: {
120
- type: {
121
- type: "choice",
122
- options: ["line", "card", "editable-card"],
123
- defaultValueHint: "line",
124
- description: "Basic style of tabs",
125
- },
126
- addIcon: {
127
- type: "slot",
128
- hidePlaceholder: true,
129
- },
130
- animated: {
131
- type: "object",
132
- hidden: function (props) { return props.tabPosition !== "top" && !!props.tabPosition; },
133
- defaultValueHint: { inkBar: true, tabPane: false },
134
- description: "Whether to change tabs with animation. Can be either a boolean or specify for inkBar and tabPane",
135
- },
136
- hideAdd: {
137
- type: "boolean",
138
- hidden: function (props) { return props.type !== "editable-card"; },
139
- defaultValueHint: false,
140
- description: "Hide plus icon or not",
141
- },
142
- moreIcon: {
143
- type: "slot",
144
- hidePlaceholder: true,
145
- },
146
- size: {
147
- type: "choice",
148
- options: ["large", "default", "small"],
149
- defaultValueHint: "default",
150
- description: "Preset tab bar size",
151
- },
152
- tabPosition: {
153
- type: "choice",
154
- options: ["top", "right", "bottom", "left"],
155
- defaultValueHint: "top",
156
- description: "Position of tabs",
157
- },
158
- tabBarGutter: {
159
- type: "number",
160
- description: "The gap between tabs",
161
- },
162
- centered: {
163
- type: "boolean",
164
- description: "Centers tabs",
165
- defaultValueHint: false,
166
- },
167
- leftTabBarExtraContent: {
168
- type: "slot",
169
- hidePlaceholder: true,
170
- },
171
- rightTabBarExtraContent: {
172
- type: "slot",
173
- hidePlaceholder: true,
174
- },
175
- tabBarStyle: {
176
- type: "object",
177
- description: "CSS for the Tab Bar style",
178
- },
179
- activeKey: {
180
- type: "choice",
181
- editOnly: true,
182
- uncontrolledProp: "defaultActiveKey",
183
- description: "Initial active TabPane's key",
184
- options: function (props) {
185
- var options = new Set();
186
- customControls.traverseReactEltTree(props.children, function (elt) {
187
- if ((elt === null || elt === void 0 ? void 0 : elt.type) === rcTabs.TabPane && typeof (elt === null || elt === void 0 ? void 0 : elt.key) === "string") {
188
- options.add(elt.key);
189
- }
190
- });
191
- return Array.from(options.keys());
192
- },
193
- },
194
- children: {
195
- type: "slot",
196
- allowedComponents: ["AntdTabPane"],
197
- defaultValue: [
198
- {
199
- type: "component",
200
- name: "AntdTabPane",
201
- props: {
202
- key: "1",
203
- tab: [
204
- {
205
- type: "text",
206
- value: "Tab",
207
- },
208
- ],
209
- children: [
210
- {
211
- type: "text",
212
- value: "Tab content",
213
- },
214
- ],
215
- },
216
- },
217
- {
218
- type: "component",
219
- name: "AntdTabPane",
220
- props: {
221
- key: "2",
222
- tab: [
223
- {
224
- type: "text",
225
- value: "Tab",
226
- },
227
- ],
228
- children: [
229
- {
230
- type: "text",
231
- value: "Tab content",
232
- },
233
- ],
234
- },
235
- },
236
- ],
237
- },
238
- },
239
- actions: [
240
- {
241
- type: "custom-action",
242
- control: NavigateTabs,
243
- },
244
- {
245
- type: "button-action",
246
- label: "Add new tab",
247
- onClick: function (_a) {
248
- var componentProps = _a.componentProps, studioOps = _a.studioOps;
249
- // Get the first positive integer that isn't already a key
250
- var generateNewKey = function () {
251
- var keysSet = new Set();
252
- customControls.traverseReactEltTree(componentProps.children, function (elt) {
253
- if ((elt === null || elt === void 0 ? void 0 : elt.type) === rcTabs.TabPane && typeof (elt === null || elt === void 0 ? void 0 : elt.key) === "string") {
254
- keysSet.add(elt.key);
255
- }
256
- });
257
- for (var keyCandidate = 1; keyCandidate <= keysSet.size + 1; keyCandidate++) {
258
- var strKey = keyCandidate.toString();
259
- if (!keysSet.has(strKey)) {
260
- return strKey;
261
- }
262
- }
263
- return undefined;
264
- };
265
- var tabKey = generateNewKey();
266
- studioOps.appendToSlot({
267
- type: "component",
268
- name: "AntdTabPane",
269
- props: {
270
- key: tabKey,
271
- },
272
- }, "children");
273
- studioOps.updateProps({ activeKey: tabKey });
274
- },
275
- },
276
- {
277
- type: "button-action",
278
- label: "Delete current tab",
279
- onClick: function (_a) {
280
- var componentProps = _a.componentProps, studioOps = _a.studioOps;
281
- if (componentProps.activeKey) {
282
- var tabPanes_1 = [];
283
- customControls.traverseReactEltTree(componentProps.children, function (elt) {
284
- if ((elt === null || elt === void 0 ? void 0 : elt.type) === rcTabs.TabPane && typeof (elt === null || elt === void 0 ? void 0 : elt.key) === "string") {
285
- tabPanes_1.push(elt.key);
286
- }
287
- });
288
- var activeKey_1 = componentProps.activeKey;
289
- var currTabPos = tabPanes_1.findIndex(function (tabKey) {
290
- return tabKey === activeKey_1;
291
- });
292
- if (currTabPos !== -1) {
293
- studioOps.removeFromSlotAt(currTabPos, "children");
294
- if (tabPanes_1.length - 1 > 0) {
295
- var prevTabPos = (currTabPos - 1 + tabPanes_1.length) % tabPanes_1.length;
296
- studioOps.updateProps({ activeKey: tabPanes_1[prevTabPos] });
297
- }
298
- }
299
- }
300
- },
301
- },
302
- {
303
- type: "custom-action",
304
- control: OutlineMessage,
305
- },
306
- ],
307
- importPath: "@plasmicpkgs/antd/skinny/registerTabs",
308
- importName: "Tabs",
309
- };
310
- function registerTabs(loader, customTabsMeta) {
311
- var doRegisterComponent = function () {
312
- var args = [];
313
- for (var _i = 0; _i < arguments.length; _i++) {
314
- args[_i] = arguments[_i];
315
- }
316
- return loader ? loader.registerComponent.apply(loader, args) : registerComponent.apply(void 0, args);
317
- };
318
- doRegisterComponent(Tabs, customTabsMeta !== null && customTabsMeta !== void 0 ? customTabsMeta : tabsMeta);
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var registerComponent__default = /*#__PURE__*/_interopDefault(registerComponent);
12
+ var AntdTabs__default = /*#__PURE__*/_interopDefault(AntdTabs);
13
+ var React__default = /*#__PURE__*/_interopDefault(React);
14
+
15
+ var __defProp = Object.defineProperty;
16
+ var __defProps = Object.defineProperties;
17
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
18
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
19
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
20
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
21
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22
+ var __spreadValues = (a, b) => {
23
+ for (var prop in b || (b = {}))
24
+ if (__hasOwnProp.call(b, prop))
25
+ __defNormalProp(a, prop, b[prop]);
26
+ if (__getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(b)) {
28
+ if (__propIsEnum.call(b, prop))
29
+ __defNormalProp(a, prop, b[prop]);
30
+ }
31
+ return a;
32
+ };
33
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
34
+ var __objRest = (source, exclude) => {
35
+ var target = {};
36
+ for (var prop in source)
37
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
38
+ target[prop] = source[prop];
39
+ if (source != null && __getOwnPropSymbols)
40
+ for (var prop of __getOwnPropSymbols(source)) {
41
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
42
+ target[prop] = source[prop];
43
+ }
44
+ return target;
45
+ };
46
+ const TabPane = AntdTabs__default.default.TabPane;
47
+ const tabPaneMeta = {
48
+ name: "AntdTabPane",
49
+ displayName: "Antd Tab Pane",
50
+ props: {
51
+ tab: {
52
+ type: "slot",
53
+ defaultValue: [
54
+ {
55
+ type: "text",
56
+ value: "Tab"
57
+ }
58
+ ]
59
+ },
60
+ key: {
61
+ type: "string",
62
+ description: "Unique TabPane's key",
63
+ defaultValue: "tabPaneKey"
64
+ },
65
+ closable: {
66
+ type: "boolean",
67
+ description: "Wether the tab can be closed or not. Only works for editable tabs",
68
+ defaultValueHint: true
69
+ },
70
+ disabled: {
71
+ type: "boolean",
72
+ description: "Disabled state of tab",
73
+ defaultValueHint: false
74
+ },
75
+ forceRender: {
76
+ type: "boolean",
77
+ description: "Forced render of content in tabs, not lazy render after clicking on tabs",
78
+ defaultValueHint: false
79
+ },
80
+ closeIcon: {
81
+ type: "slot",
82
+ hidePlaceholder: true
83
+ },
84
+ children: {
85
+ type: "slot",
86
+ defaultValue: [
87
+ {
88
+ type: "text",
89
+ value: "Tab Content"
90
+ }
91
+ ]
92
+ }
93
+ },
94
+ parentComponentName: "AntdTabs",
95
+ importPath: "@plasmicpkgs/antd/skinny/registerTabs",
96
+ importName: "TabPane"
97
+ };
98
+ function registerTabPane(loader, customTabPaneMeta) {
99
+ const doRegisterComponent = (...args) => loader ? loader.registerComponent(...args) : registerComponent__default.default(...args);
100
+ doRegisterComponent(TabPane, customTabPaneMeta != null ? customTabPaneMeta : tabPaneMeta);
101
+ }
102
+ function Tabs(props) {
103
+ const _a = props, {
104
+ leftTabBarExtraContent,
105
+ rightTabBarExtraContent
106
+ } = _a, otherProps = __objRest(_a, [
107
+ "leftTabBarExtraContent",
108
+ "rightTabBarExtraContent"
109
+ ]);
110
+ return /* @__PURE__ */ React__default.default.createElement(AntdTabs__default.default, __spreadProps(__spreadValues({}, otherProps), {
111
+ tabBarExtraContent: {
112
+ left: leftTabBarExtraContent,
113
+ right: rightTabBarExtraContent
114
+ }
115
+ }));
116
+ }
117
+ function NavigateTabs({ componentProps, studioOps }) {
118
+ const tabPanes = [];
119
+ customControls.traverseReactEltTree(componentProps.children, (elt) => {
120
+ if ((elt == null ? void 0 : elt.type) === TabPane && typeof (elt == null ? void 0 : elt.key) === "string") {
121
+ tabPanes.push(elt.key);
122
+ }
123
+ });
124
+ const activeKey = componentProps.activeKey;
125
+ const currTabPos = activeKey ? tabPanes.findIndex((tabKey) => {
126
+ return tabKey === activeKey;
127
+ }) : 0;
128
+ return /* @__PURE__ */ React__default.default.createElement("div", {
129
+ style: {
130
+ width: "100%",
131
+ display: "flex",
132
+ flexDirection: "row",
133
+ gap: "10px",
134
+ justifyContent: "space-between"
135
+ }
136
+ }, /* @__PURE__ */ React__default.default.createElement(antd.Button, {
137
+ style: { width: "100%" },
138
+ onClick: () => {
139
+ if (tabPanes.length > 0) {
140
+ const prevTabPos = (currTabPos - 1 + tabPanes.length) % tabPanes.length;
141
+ studioOps.updateProps({ activeKey: tabPanes[prevTabPos] });
142
+ }
143
+ }
144
+ }, "Prev tab"), /* @__PURE__ */ React__default.default.createElement(antd.Button, {
145
+ style: { width: "100%" },
146
+ onClick: () => {
147
+ if (tabPanes.length > 0) {
148
+ const nextTabPos = (currTabPos + 1) % tabPanes.length;
149
+ studioOps.updateProps({ activeKey: tabPanes[nextTabPos] });
150
+ }
151
+ }
152
+ }, "Next tab"));
153
+ }
154
+ function OutlineMessage() {
155
+ return /* @__PURE__ */ React__default.default.createElement("div", null, "* To re-arrange tab panes, use the Outline panel");
156
+ }
157
+ const tabsMeta = {
158
+ name: "AntdTabs",
159
+ displayName: "Antd Tabs",
160
+ props: {
161
+ type: {
162
+ type: "choice",
163
+ options: ["line", "card", "editable-card"],
164
+ defaultValueHint: "line",
165
+ description: "Basic style of tabs"
166
+ },
167
+ addIcon: {
168
+ type: "slot",
169
+ hidePlaceholder: true
170
+ },
171
+ animated: {
172
+ type: "object",
173
+ hidden: (props) => props.tabPosition !== "top" && !!props.tabPosition,
174
+ defaultValueHint: { inkBar: true, tabPane: false },
175
+ description: "Whether to change tabs with animation. Can be either a boolean or specify for inkBar and tabPane"
176
+ },
177
+ hideAdd: {
178
+ type: "boolean",
179
+ hidden: (props) => props.type !== "editable-card",
180
+ defaultValueHint: false,
181
+ description: "Hide plus icon or not"
182
+ },
183
+ moreIcon: {
184
+ type: "slot",
185
+ hidePlaceholder: true
186
+ },
187
+ size: {
188
+ type: "choice",
189
+ options: ["large", "default", "small"],
190
+ defaultValueHint: "default",
191
+ description: "Preset tab bar size"
192
+ },
193
+ tabPosition: {
194
+ type: "choice",
195
+ options: ["top", "right", "bottom", "left"],
196
+ defaultValueHint: "top",
197
+ description: "Position of tabs"
198
+ },
199
+ tabBarGutter: {
200
+ type: "number",
201
+ description: "The gap between tabs"
202
+ },
203
+ centered: {
204
+ type: "boolean",
205
+ description: "Centers tabs",
206
+ defaultValueHint: false
207
+ },
208
+ leftTabBarExtraContent: {
209
+ type: "slot",
210
+ hidePlaceholder: true
211
+ },
212
+ rightTabBarExtraContent: {
213
+ type: "slot",
214
+ hidePlaceholder: true
215
+ },
216
+ tabBarStyle: {
217
+ type: "object",
218
+ description: "CSS for the Tab Bar style"
219
+ },
220
+ activeKey: {
221
+ type: "choice",
222
+ editOnly: true,
223
+ uncontrolledProp: "defaultActiveKey",
224
+ description: "Initial active TabPane's key",
225
+ options: (props) => {
226
+ const options = /* @__PURE__ */ new Set();
227
+ customControls.traverseReactEltTree(props.children, (elt) => {
228
+ if ((elt == null ? void 0 : elt.type) === TabPane && typeof (elt == null ? void 0 : elt.key) === "string") {
229
+ options.add(elt.key);
230
+ }
231
+ });
232
+ return Array.from(options.keys());
233
+ }
234
+ },
235
+ children: {
236
+ type: "slot",
237
+ allowedComponents: ["AntdTabPane"],
238
+ defaultValue: [
239
+ {
240
+ type: "component",
241
+ name: "AntdTabPane",
242
+ props: {
243
+ key: "1",
244
+ tab: [
245
+ {
246
+ type: "text",
247
+ value: "Tab"
248
+ }
249
+ ],
250
+ children: [
251
+ {
252
+ type: "text",
253
+ value: "Tab content"
254
+ }
255
+ ]
256
+ }
257
+ },
258
+ {
259
+ type: "component",
260
+ name: "AntdTabPane",
261
+ props: {
262
+ key: "2",
263
+ tab: [
264
+ {
265
+ type: "text",
266
+ value: "Tab"
267
+ }
268
+ ],
269
+ children: [
270
+ {
271
+ type: "text",
272
+ value: "Tab content"
273
+ }
274
+ ]
275
+ }
276
+ }
277
+ ]
278
+ }
279
+ },
280
+ actions: [
281
+ {
282
+ type: "custom-action",
283
+ control: NavigateTabs
284
+ },
285
+ {
286
+ type: "button-action",
287
+ label: "Add new tab",
288
+ onClick: ({ componentProps, studioOps }) => {
289
+ const generateNewKey = () => {
290
+ let keysSet = /* @__PURE__ */ new Set();
291
+ customControls.traverseReactEltTree(componentProps.children, (elt) => {
292
+ if ((elt == null ? void 0 : elt.type) === TabPane && typeof (elt == null ? void 0 : elt.key) === "string") {
293
+ keysSet.add(elt.key);
294
+ }
295
+ });
296
+ for (let keyCandidate = 1; keyCandidate <= keysSet.size + 1; keyCandidate++) {
297
+ const strKey = keyCandidate.toString();
298
+ if (!keysSet.has(strKey)) {
299
+ return strKey;
300
+ }
301
+ }
302
+ return void 0;
303
+ };
304
+ const tabKey = generateNewKey();
305
+ studioOps.appendToSlot({
306
+ type: "component",
307
+ name: "AntdTabPane",
308
+ props: {
309
+ key: tabKey
310
+ }
311
+ }, "children");
312
+ studioOps.updateProps({ activeKey: tabKey });
313
+ }
314
+ },
315
+ {
316
+ type: "button-action",
317
+ label: "Delete current tab",
318
+ onClick: ({ componentProps, studioOps }) => {
319
+ if (componentProps.activeKey) {
320
+ const tabPanes = [];
321
+ customControls.traverseReactEltTree(componentProps.children, (elt) => {
322
+ if ((elt == null ? void 0 : elt.type) === TabPane && typeof (elt == null ? void 0 : elt.key) === "string") {
323
+ tabPanes.push(elt.key);
324
+ }
325
+ });
326
+ const activeKey = componentProps.activeKey;
327
+ const currTabPos = tabPanes.findIndex((tabKey) => {
328
+ return tabKey === activeKey;
329
+ });
330
+ if (currTabPos !== -1) {
331
+ studioOps.removeFromSlotAt(currTabPos, "children");
332
+ if (tabPanes.length - 1 > 0) {
333
+ const prevTabPos = (currTabPos - 1 + tabPanes.length) % tabPanes.length;
334
+ studioOps.updateProps({ activeKey: tabPanes[prevTabPos] });
335
+ }
336
+ }
337
+ }
338
+ }
339
+ },
340
+ {
341
+ type: "custom-action",
342
+ control: OutlineMessage
343
+ }
344
+ ],
345
+ importPath: "@plasmicpkgs/antd/skinny/registerTabs",
346
+ importName: "Tabs"
347
+ };
348
+ function registerTabs(loader, customTabsMeta) {
349
+ const doRegisterComponent = (...args) => loader ? loader.registerComponent(...args) : registerComponent__default.default(...args);
350
+ doRegisterComponent(Tabs, customTabsMeta != null ? customTabsMeta : tabsMeta);
319
351
  }
320
352
 
353
+ exports.TabPane = TabPane;
321
354
  exports.Tabs = Tabs;
322
355
  exports.registerTabPane = registerTabPane;
323
356
  exports.registerTabs = registerTabs;