@plasmicpkgs/react-aria 0.0.89 → 0.0.90
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/.tsbuildinfo +1 -1
- package/dist/{ListBoxItemIdManager.d.ts → OptionsItemIdManager.d.ts} +1 -1
- package/dist/contexts.d.ts +8 -4
- package/dist/react-aria.esm.js +187 -76
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +186 -75
- package/dist/react-aria.js.map +1 -1
- package/dist/registerCheckbox.d.ts +5 -2
- package/dist/registerCheckboxGroup.d.ts +5 -2
- package/dist/registerRadio.d.ts +5 -2
- package/dist/registerRadioGroup.d.ts +5 -2
- package/package.json +2 -2
- package/skinny/OptionsItemIdManager-832b8cfe.esm.js +54 -0
- package/skinny/OptionsItemIdManager-832b8cfe.esm.js.map +1 -0
- package/skinny/OptionsItemIdManager-a89a28b9.cjs.js +56 -0
- package/skinny/OptionsItemIdManager-a89a28b9.cjs.js.map +1 -0
- package/skinny/{ListBoxItemIdManager.d.ts → OptionsItemIdManager.d.ts} +1 -1
- package/skinny/{common-7ecf439d.esm.js → common-d75204cf.esm.js} +2 -2
- package/skinny/{common-7ecf439d.esm.js.map → common-d75204cf.esm.js.map} +1 -1
- package/skinny/contexts-5cb81c2f.esm.js.map +1 -1
- package/skinny/contexts-6d0cb2b1.cjs.js.map +1 -1
- package/skinny/contexts.d.ts +8 -4
- package/skinny/registerButton.esm.js +2 -2
- package/skinny/registerCheckbox.cjs.js +48 -4
- package/skinny/registerCheckbox.cjs.js.map +1 -1
- package/skinny/registerCheckbox.d.ts +5 -2
- package/skinny/registerCheckbox.esm.js +51 -7
- package/skinny/registerCheckbox.esm.js.map +1 -1
- package/skinny/registerCheckboxGroup.cjs.js +19 -8
- package/skinny/registerCheckboxGroup.cjs.js.map +1 -1
- package/skinny/registerCheckboxGroup.d.ts +5 -2
- package/skinny/registerCheckboxGroup.esm.js +22 -11
- package/skinny/registerCheckboxGroup.esm.js.map +1 -1
- package/skinny/registerComboBox.cjs.js +4 -3
- package/skinny/registerComboBox.cjs.js.map +1 -1
- package/skinny/registerComboBox.esm.js +6 -5
- package/skinny/registerComboBox.esm.js.map +1 -1
- package/skinny/registerDescription.esm.js +1 -1
- package/skinny/registerDialogTrigger.esm.js +2 -2
- package/skinny/registerFieldError.esm.js +1 -1
- package/skinny/registerForm.esm.js +1 -1
- package/skinny/registerHeading.esm.js +1 -1
- package/skinny/registerInput.esm.js +2 -2
- package/skinny/registerLabel.esm.js +1 -1
- package/skinny/{registerListBox-7d927361.cjs.js → registerListBox-25f29573.cjs.js} +3 -55
- package/skinny/registerListBox-25f29573.cjs.js.map +1 -0
- package/skinny/{registerListBox-4d5f98f9.esm.js → registerListBox-b6e4aabc.esm.js} +5 -56
- package/skinny/registerListBox-b6e4aabc.esm.js.map +1 -0
- package/skinny/registerListBox.cjs.js +2 -1
- package/skinny/registerListBox.cjs.js.map +1 -1
- package/skinny/registerListBox.esm.js +3 -2
- package/skinny/registerListBox.esm.js.map +1 -1
- package/skinny/registerListBoxItem.esm.js +1 -1
- package/skinny/registerModal.esm.js +2 -2
- package/skinny/registerOverlayArrow.esm.js +2 -2
- package/skinny/registerPopover.esm.js +2 -2
- package/skinny/registerRadio.cjs.js +47 -4
- package/skinny/registerRadio.cjs.js.map +1 -1
- package/skinny/registerRadio.d.ts +5 -2
- package/skinny/registerRadio.esm.js +50 -7
- package/skinny/registerRadio.esm.js.map +1 -1
- package/skinny/registerRadioGroup.cjs.js +19 -4
- package/skinny/registerRadioGroup.cjs.js.map +1 -1
- package/skinny/registerRadioGroup.d.ts +5 -2
- package/skinny/registerRadioGroup.esm.js +22 -7
- package/skinny/registerRadioGroup.esm.js.map +1 -1
- package/skinny/registerSection.cjs.js +2 -1
- package/skinny/registerSection.cjs.js.map +1 -1
- package/skinny/registerSection.esm.js +3 -2
- package/skinny/registerSection.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +4 -3
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.esm.js +6 -5
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/registerSlider.esm.js +2 -2
- package/skinny/registerSliderOutput.esm.js +1 -1
- package/skinny/registerSliderThumb.esm.js +2 -2
- package/skinny/registerSliderTrack.esm.js +1 -1
- package/skinny/registerSwitch.esm.js +2 -2
- package/skinny/registerText.esm.js +1 -1
- package/skinny/registerTextArea.esm.js +2 -2
- package/skinny/registerTextField.esm.js +2 -2
- package/skinny/registerTooltip.esm.js +2 -2
- package/skinny/{utils-41b3d43b.esm.js → utils-bcdc928e.esm.js} +2 -2
- package/skinny/{utils-41b3d43b.esm.js.map → utils-bcdc928e.esm.js.map} +1 -1
- package/skinny/registerListBox-4d5f98f9.esm.js.map +0 -1
- package/skinny/registerListBox-7d927361.cjs.js.map +0 -1
package/dist/react-aria.js
CHANGED
|
@@ -785,12 +785,50 @@ const CHECKBOX_VARIANTS = [
|
|
|
785
785
|
];
|
|
786
786
|
const { variants: variants$g, withObservedValues: withObservedValues$d } = pickAriaComponentVariants(CHECKBOX_VARIANTS);
|
|
787
787
|
function BaseCheckbox(props) {
|
|
788
|
-
const _a = props, {
|
|
788
|
+
const _a = props, {
|
|
789
|
+
children,
|
|
790
|
+
plasmicUpdateVariant,
|
|
791
|
+
setControlContextData,
|
|
792
|
+
value
|
|
793
|
+
} = _a, rest = __objRest$l(_a, [
|
|
794
|
+
"children",
|
|
795
|
+
"plasmicUpdateVariant",
|
|
796
|
+
"setControlContextData",
|
|
797
|
+
"value"
|
|
798
|
+
]);
|
|
789
799
|
const contextProps = React__default.default.useContext(PlasmicCheckboxGroupContext);
|
|
800
|
+
const isStandalone = !contextProps;
|
|
801
|
+
const [registeredId, setRegisteredId] = React.useState();
|
|
802
|
+
React.useEffect(() => {
|
|
803
|
+
if (!(contextProps == null ? void 0 : contextProps.idManager)) {
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
const localId = contextProps.idManager.register(value);
|
|
807
|
+
setRegisteredId(localId);
|
|
808
|
+
return () => {
|
|
809
|
+
contextProps.idManager.unregister(localId);
|
|
810
|
+
setRegisteredId(void 0);
|
|
811
|
+
};
|
|
812
|
+
}, [value, contextProps == null ? void 0 : contextProps.idManager]);
|
|
790
813
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
791
|
-
parent: contextProps
|
|
814
|
+
parent: contextProps,
|
|
815
|
+
idError: (() => {
|
|
816
|
+
if (value === void 0) {
|
|
817
|
+
return "Value must be defined";
|
|
818
|
+
}
|
|
819
|
+
if (typeof value !== "string") {
|
|
820
|
+
return "Value must be a string";
|
|
821
|
+
}
|
|
822
|
+
if (!value.trim()) {
|
|
823
|
+
return "Value must be defined";
|
|
824
|
+
}
|
|
825
|
+
if (!isStandalone && value != registeredId) {
|
|
826
|
+
return "Value must be unique";
|
|
827
|
+
}
|
|
828
|
+
return void 0;
|
|
829
|
+
})()
|
|
792
830
|
});
|
|
793
|
-
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Checkbox, __spreadValues$o({}, rest), ({
|
|
831
|
+
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Checkbox, __spreadProps$f(__spreadValues$o({}, rest), { value: registeredId, key: registeredId }), ({
|
|
794
832
|
isHovered,
|
|
795
833
|
isPressed,
|
|
796
834
|
isFocused,
|
|
@@ -890,7 +928,13 @@ function registerCheckbox(loader, overrides) {
|
|
|
890
928
|
value: {
|
|
891
929
|
type: "string",
|
|
892
930
|
description: 'The value of the checkbox in "selected" state, used when submitting an HTML form.',
|
|
893
|
-
defaultValueHint: "on"
|
|
931
|
+
defaultValueHint: "on",
|
|
932
|
+
validator: (_value, _props, ctx) => {
|
|
933
|
+
if (ctx == null ? void 0 : ctx.idError) {
|
|
934
|
+
return ctx.idError;
|
|
935
|
+
}
|
|
936
|
+
return true;
|
|
937
|
+
}
|
|
894
938
|
},
|
|
895
939
|
isSelected: {
|
|
896
940
|
type: "boolean",
|
|
@@ -939,6 +983,58 @@ function registerCheckbox(loader, overrides) {
|
|
|
939
983
|
);
|
|
940
984
|
}
|
|
941
985
|
|
|
986
|
+
class OptionsItemIdManager {
|
|
987
|
+
constructor() {
|
|
988
|
+
this._ids = /* @__PURE__ */ new Set();
|
|
989
|
+
this._observers = /* @__PURE__ */ new Set();
|
|
990
|
+
}
|
|
991
|
+
generateDuplicateId(id, count = 1) {
|
|
992
|
+
const dupId = `${id} duplicate(${count})`;
|
|
993
|
+
if (this._ids.has(dupId)) {
|
|
994
|
+
return this.generateDuplicateId(id, count + 1);
|
|
995
|
+
} else {
|
|
996
|
+
return dupId;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
generateMissingId(count = 1) {
|
|
1000
|
+
const missingId = `missing(${count})`;
|
|
1001
|
+
if (this._ids.has(missingId)) {
|
|
1002
|
+
return this.generateMissingId(count + 1);
|
|
1003
|
+
} else {
|
|
1004
|
+
return missingId;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
register(id) {
|
|
1008
|
+
const idStr = id === void 0 ? void 0 : String(id).trim();
|
|
1009
|
+
let newId;
|
|
1010
|
+
if (!idStr) {
|
|
1011
|
+
newId = this.generateMissingId();
|
|
1012
|
+
} else if (this._ids.has(idStr)) {
|
|
1013
|
+
newId = this.generateDuplicateId(idStr);
|
|
1014
|
+
} else {
|
|
1015
|
+
newId = idStr;
|
|
1016
|
+
}
|
|
1017
|
+
this._ids.add(newId);
|
|
1018
|
+
this.notify();
|
|
1019
|
+
return newId;
|
|
1020
|
+
}
|
|
1021
|
+
unregister(id) {
|
|
1022
|
+
this._ids.delete(id);
|
|
1023
|
+
this.notify();
|
|
1024
|
+
}
|
|
1025
|
+
subscribe(observer) {
|
|
1026
|
+
this._observers.add(observer);
|
|
1027
|
+
observer(this.ids);
|
|
1028
|
+
}
|
|
1029
|
+
// Notify all observers about an event.
|
|
1030
|
+
notify() {
|
|
1031
|
+
this._observers.forEach((observer) => observer(this.ids));
|
|
1032
|
+
}
|
|
1033
|
+
get ids() {
|
|
1034
|
+
return Array.from(this._ids);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
|
|
942
1038
|
var __defProp$n = Object.defineProperty;
|
|
943
1039
|
var __defProps$e = Object.defineProperties;
|
|
944
1040
|
var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
|
|
@@ -1140,8 +1236,20 @@ const { variants: variants$f, withObservedValues: withObservedValues$c } = pickA
|
|
|
1140
1236
|
CHECKBOX_GROUP_VARIANTS
|
|
1141
1237
|
);
|
|
1142
1238
|
function BaseCheckboxGroup(props) {
|
|
1143
|
-
const _a = props, { children, plasmicUpdateVariant } = _a, rest = __objRest$i(_a, ["children", "plasmicUpdateVariant"]);
|
|
1144
|
-
|
|
1239
|
+
const _a = props, { children, plasmicUpdateVariant, setControlContextData } = _a, rest = __objRest$i(_a, ["children", "plasmicUpdateVariant", "setControlContextData"]);
|
|
1240
|
+
const [ids, setIds] = React.useState([]);
|
|
1241
|
+
const idManager = React.useMemo(() => new OptionsItemIdManager(), []);
|
|
1242
|
+
React.useEffect(() => {
|
|
1243
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
1244
|
+
values: ids
|
|
1245
|
+
});
|
|
1246
|
+
}, [ids, setControlContextData]);
|
|
1247
|
+
React.useEffect(() => {
|
|
1248
|
+
idManager.subscribe((_ids) => {
|
|
1249
|
+
setIds(_ids);
|
|
1250
|
+
});
|
|
1251
|
+
}, [idManager]);
|
|
1252
|
+
return /* @__PURE__ */ React__default.default.createElement(PlasmicCheckboxGroupContext.Provider, { value: __spreadProps$b(__spreadValues$k({}, rest), { idManager }) }, /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.CheckboxGroup, __spreadValues$k({}, rest), ({ isDisabled, isReadOnly }) => withObservedValues$c(
|
|
1145
1253
|
children,
|
|
1146
1254
|
{
|
|
1147
1255
|
disabled: isDisabled,
|
|
@@ -1152,10 +1260,6 @@ function BaseCheckboxGroup(props) {
|
|
|
1152
1260
|
}
|
|
1153
1261
|
const componentName = makeComponentName("checkboxGroup");
|
|
1154
1262
|
function registerCheckboxGroup(loader, overrides) {
|
|
1155
|
-
makeChildComponentName(
|
|
1156
|
-
overrides == null ? void 0 : overrides.parentComponentName,
|
|
1157
|
-
componentName
|
|
1158
|
-
);
|
|
1159
1263
|
registerComponentHelper(
|
|
1160
1264
|
loader,
|
|
1161
1265
|
BaseCheckboxGroup,
|
|
@@ -1242,10 +1346,12 @@ function registerCheckboxGroup(loader, overrides) {
|
|
|
1242
1346
|
]
|
|
1243
1347
|
},
|
|
1244
1348
|
value: {
|
|
1245
|
-
type: "
|
|
1349
|
+
type: "choice",
|
|
1246
1350
|
editOnly: true,
|
|
1247
1351
|
uncontrolledProp: "defaultValue",
|
|
1248
|
-
description: "The current value"
|
|
1352
|
+
description: "The current value",
|
|
1353
|
+
options: (_props, ctx) => (ctx == null ? void 0 : ctx.values) ? Array.from(ctx.values) : [],
|
|
1354
|
+
multiSelect: true
|
|
1249
1355
|
},
|
|
1250
1356
|
isInvalid: {
|
|
1251
1357
|
displayName: "Invalid",
|
|
@@ -1278,58 +1384,6 @@ function registerCheckboxGroup(loader, overrides) {
|
|
|
1278
1384
|
);
|
|
1279
1385
|
}
|
|
1280
1386
|
|
|
1281
|
-
class ListBoxItemIdManager {
|
|
1282
|
-
constructor() {
|
|
1283
|
-
this._ids = /* @__PURE__ */ new Set();
|
|
1284
|
-
this._observers = /* @__PURE__ */ new Set();
|
|
1285
|
-
}
|
|
1286
|
-
generateDuplicateId(id, count = 1) {
|
|
1287
|
-
const dupId = `${id} duplicate(${count})`;
|
|
1288
|
-
if (this._ids.has(dupId)) {
|
|
1289
|
-
return this.generateDuplicateId(id, count + 1);
|
|
1290
|
-
} else {
|
|
1291
|
-
return dupId;
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
generateMissingId(count = 1) {
|
|
1295
|
-
const missingId = `missing(${count})`;
|
|
1296
|
-
if (this._ids.has(missingId)) {
|
|
1297
|
-
return this.generateMissingId(count + 1);
|
|
1298
|
-
} else {
|
|
1299
|
-
return missingId;
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
register(id) {
|
|
1303
|
-
const idStr = id === void 0 ? void 0 : String(id).trim();
|
|
1304
|
-
let newId;
|
|
1305
|
-
if (!idStr) {
|
|
1306
|
-
newId = this.generateMissingId();
|
|
1307
|
-
} else if (this._ids.has(idStr)) {
|
|
1308
|
-
newId = this.generateDuplicateId(idStr);
|
|
1309
|
-
} else {
|
|
1310
|
-
newId = idStr;
|
|
1311
|
-
}
|
|
1312
|
-
this._ids.add(newId);
|
|
1313
|
-
this.notify();
|
|
1314
|
-
return newId;
|
|
1315
|
-
}
|
|
1316
|
-
unregister(id) {
|
|
1317
|
-
this._ids.delete(id);
|
|
1318
|
-
this.notify();
|
|
1319
|
-
}
|
|
1320
|
-
subscribe(observer) {
|
|
1321
|
-
this._observers.add(observer);
|
|
1322
|
-
observer(this.ids);
|
|
1323
|
-
}
|
|
1324
|
-
// Notify all observers about an event.
|
|
1325
|
-
notify() {
|
|
1326
|
-
this._observers.forEach((observer) => observer(this.ids));
|
|
1327
|
-
}
|
|
1328
|
-
get ids() {
|
|
1329
|
-
return Array.from(this._ids);
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
1387
|
var __defProp$j = Object.defineProperty;
|
|
1334
1388
|
var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
|
|
1335
1389
|
var __hasOwnProp$j = Object.prototype.hasOwnProperty;
|
|
@@ -1798,7 +1852,7 @@ function BaseListBox(props) {
|
|
|
1798
1852
|
const idManager = React.useMemo(
|
|
1799
1853
|
() => {
|
|
1800
1854
|
var _a2;
|
|
1801
|
-
return (_a2 = context == null ? void 0 : context.idManager) != null ? _a2 : new
|
|
1855
|
+
return (_a2 = context == null ? void 0 : context.idManager) != null ? _a2 : new OptionsItemIdManager();
|
|
1802
1856
|
},
|
|
1803
1857
|
[]
|
|
1804
1858
|
);
|
|
@@ -2245,7 +2299,7 @@ function BaseComboBox(props) {
|
|
|
2245
2299
|
},
|
|
2246
2300
|
[className, plasmicUpdateVariant]
|
|
2247
2301
|
);
|
|
2248
|
-
const idManager = React.useMemo(() => new
|
|
2302
|
+
const idManager = React.useMemo(() => new OptionsItemIdManager(), []);
|
|
2249
2303
|
React.useEffect(() => {
|
|
2250
2304
|
idManager.subscribe((ids) => {
|
|
2251
2305
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
@@ -2870,13 +2924,50 @@ const RADIO_VARIANTS = [
|
|
|
2870
2924
|
];
|
|
2871
2925
|
const { variants: variants$9, withObservedValues: withObservedValues$8 } = pickAriaComponentVariants(RADIO_VARIANTS);
|
|
2872
2926
|
function BaseRadio(props) {
|
|
2873
|
-
const _a = props, {
|
|
2927
|
+
const _a = props, {
|
|
2928
|
+
children,
|
|
2929
|
+
setControlContextData,
|
|
2930
|
+
plasmicUpdateVariant,
|
|
2931
|
+
value
|
|
2932
|
+
} = _a, rest = __objRest$8(_a, [
|
|
2933
|
+
"children",
|
|
2934
|
+
"setControlContextData",
|
|
2935
|
+
"plasmicUpdateVariant",
|
|
2936
|
+
"value"
|
|
2937
|
+
]);
|
|
2874
2938
|
const contextProps = React__default.default.useContext(PlasmicRadioGroupContext);
|
|
2875
2939
|
const isStandalone = !contextProps;
|
|
2940
|
+
const [registeredId, setRegisteredId] = React.useState("");
|
|
2941
|
+
React.useEffect(() => {
|
|
2942
|
+
if (!(contextProps == null ? void 0 : contextProps.idManager)) {
|
|
2943
|
+
return;
|
|
2944
|
+
}
|
|
2945
|
+
const localId = contextProps.idManager.register(value);
|
|
2946
|
+
setRegisteredId(localId);
|
|
2947
|
+
return () => {
|
|
2948
|
+
contextProps.idManager.unregister(localId);
|
|
2949
|
+
setRegisteredId("");
|
|
2950
|
+
};
|
|
2951
|
+
}, [value, contextProps == null ? void 0 : contextProps.idManager]);
|
|
2876
2952
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
2877
|
-
parent: contextProps
|
|
2953
|
+
parent: contextProps,
|
|
2954
|
+
idError: (() => {
|
|
2955
|
+
if (value === void 0) {
|
|
2956
|
+
return "Value must be defined";
|
|
2957
|
+
}
|
|
2958
|
+
if (typeof value !== "string") {
|
|
2959
|
+
return "Value must be a string";
|
|
2960
|
+
}
|
|
2961
|
+
if (!value.trim()) {
|
|
2962
|
+
return "Value must be defined";
|
|
2963
|
+
}
|
|
2964
|
+
if (!isStandalone && value != registeredId) {
|
|
2965
|
+
return "Value must be unique";
|
|
2966
|
+
}
|
|
2967
|
+
return void 0;
|
|
2968
|
+
})()
|
|
2878
2969
|
});
|
|
2879
|
-
const radio = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Radio, __spreadValues$a({}, rest), ({
|
|
2970
|
+
const radio = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Radio, __spreadProps$7(__spreadValues$a({}, rest), { value: registeredId, key: registeredId }), ({
|
|
2880
2971
|
isHovered,
|
|
2881
2972
|
isPressed,
|
|
2882
2973
|
isFocused,
|
|
@@ -2956,7 +3047,13 @@ function registerRadio(loader, overrides) {
|
|
|
2956
3047
|
},
|
|
2957
3048
|
value: {
|
|
2958
3049
|
type: "string",
|
|
2959
|
-
description: "The value of the input element, used when submitting an HTML form."
|
|
3050
|
+
description: "The value of the input element, used when submitting an HTML form.",
|
|
3051
|
+
validator: (_value, _props, ctx) => {
|
|
3052
|
+
if (ctx == null ? void 0 : ctx.idError) {
|
|
3053
|
+
return ctx.idError;
|
|
3054
|
+
}
|
|
3055
|
+
return true;
|
|
3056
|
+
}
|
|
2960
3057
|
}
|
|
2961
3058
|
}),
|
|
2962
3059
|
trapsFocus: true
|
|
@@ -2999,8 +3096,20 @@ var __objRest$7 = (source, exclude) => {
|
|
|
2999
3096
|
const RADIO_GROUP_VARIANTS = ["disabled", "readonly"];
|
|
3000
3097
|
const { variants: variants$8, withObservedValues: withObservedValues$7 } = pickAriaComponentVariants(RADIO_GROUP_VARIANTS);
|
|
3001
3098
|
function BaseRadioGroup(props) {
|
|
3002
|
-
const _a = props, { children, plasmicUpdateVariant } = _a, rest = __objRest$7(_a, ["children", "plasmicUpdateVariant"]);
|
|
3003
|
-
|
|
3099
|
+
const _a = props, { children, plasmicUpdateVariant, setControlContextData } = _a, rest = __objRest$7(_a, ["children", "plasmicUpdateVariant", "setControlContextData"]);
|
|
3100
|
+
const [ids, setIds] = React.useState([]);
|
|
3101
|
+
const idManager = React.useMemo(() => new OptionsItemIdManager(), []);
|
|
3102
|
+
React.useEffect(() => {
|
|
3103
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
3104
|
+
values: ids
|
|
3105
|
+
});
|
|
3106
|
+
}, [ids, setControlContextData]);
|
|
3107
|
+
React.useEffect(() => {
|
|
3108
|
+
idManager.subscribe((_ids) => {
|
|
3109
|
+
setIds(_ids);
|
|
3110
|
+
});
|
|
3111
|
+
}, [idManager]);
|
|
3112
|
+
return /* @__PURE__ */ React__default.default.createElement(PlasmicRadioGroupContext.Provider, { value: __spreadProps$6(__spreadValues$9({}, props), { idManager }) }, /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.RadioGroup, __spreadValues$9({}, rest), ({ isDisabled, isReadOnly }) => withObservedValues$7(
|
|
3004
3113
|
children,
|
|
3005
3114
|
{
|
|
3006
3115
|
disabled: isDisabled,
|
|
@@ -3093,11 +3202,13 @@ function registerRadioGroup(loader, overrides) {
|
|
|
3093
3202
|
]
|
|
3094
3203
|
},
|
|
3095
3204
|
value: {
|
|
3096
|
-
type: "
|
|
3205
|
+
type: "choice",
|
|
3097
3206
|
editOnly: true,
|
|
3098
3207
|
displayName: "Initial value",
|
|
3099
3208
|
uncontrolledProp: "defaultValue",
|
|
3100
|
-
description: "The current value"
|
|
3209
|
+
description: "The current value",
|
|
3210
|
+
options: (_props, ctx) => (ctx == null ? void 0 : ctx.values) ? Array.from(ctx.values) : [],
|
|
3211
|
+
multiSelect: false
|
|
3101
3212
|
},
|
|
3102
3213
|
isInvalid: {
|
|
3103
3214
|
displayName: "Invalid",
|
|
@@ -3192,7 +3303,7 @@ function BaseSelect(props) {
|
|
|
3192
3303
|
plasmicUpdateVariant,
|
|
3193
3304
|
"aria-label": ariaLabel
|
|
3194
3305
|
} = props;
|
|
3195
|
-
const idManager = React.useMemo(() => new
|
|
3306
|
+
const idManager = React.useMemo(() => new OptionsItemIdManager(), []);
|
|
3196
3307
|
React.useEffect(() => {
|
|
3197
3308
|
idManager.subscribe((ids) => {
|
|
3198
3309
|
setControlContextData == null ? void 0 : setControlContextData({
|