@plasmicpkgs/react-aria 0.0.84 → 0.0.85

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 (40) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/react-aria.esm.js +119 -116
  3. package/dist/react-aria.esm.js.map +1 -1
  4. package/dist/react-aria.js +118 -115
  5. package/dist/react-aria.js.map +1 -1
  6. package/dist/registerInput.d.ts +3 -2
  7. package/dist/registerListBox.d.ts +5 -1
  8. package/dist/registerSelect.d.ts +1 -1
  9. package/dist/registerTextArea.d.ts +3 -2
  10. package/package.json +2 -2
  11. package/skinny/registerComboBox.cjs.js +19 -24
  12. package/skinny/registerComboBox.cjs.js.map +1 -1
  13. package/skinny/registerComboBox.esm.js +20 -25
  14. package/skinny/registerComboBox.esm.js.map +1 -1
  15. package/skinny/registerInput.cjs.js +26 -43
  16. package/skinny/registerInput.cjs.js.map +1 -1
  17. package/skinny/registerInput.d.ts +3 -2
  18. package/skinny/registerInput.esm.js +27 -44
  19. package/skinny/registerInput.esm.js.map +1 -1
  20. package/skinny/{registerListBox-b47231d8.cjs.js → registerListBox-44088cfc.cjs.js} +23 -4
  21. package/skinny/registerListBox-44088cfc.cjs.js.map +1 -0
  22. package/skinny/{registerListBox-d5efc5da.esm.js → registerListBox-da15518f.esm.js} +24 -5
  23. package/skinny/registerListBox-da15518f.esm.js.map +1 -0
  24. package/skinny/registerListBox.cjs.js +2 -2
  25. package/skinny/registerListBox.d.ts +5 -1
  26. package/skinny/registerListBox.esm.js +2 -2
  27. package/skinny/registerSection.cjs.js +1 -1
  28. package/skinny/registerSection.esm.js +1 -1
  29. package/skinny/registerSelect.cjs.js +22 -8
  30. package/skinny/registerSelect.cjs.js.map +1 -1
  31. package/skinny/registerSelect.d.ts +1 -1
  32. package/skinny/registerSelect.esm.js +23 -9
  33. package/skinny/registerSelect.esm.js.map +1 -1
  34. package/skinny/registerTextArea.cjs.js +22 -29
  35. package/skinny/registerTextArea.cjs.js.map +1 -1
  36. package/skinny/registerTextArea.d.ts +3 -2
  37. package/skinny/registerTextArea.esm.js +23 -30
  38. package/skinny/registerTextArea.esm.js.map +1 -1
  39. package/skinny/registerListBox-b47231d8.cjs.js.map +0 -1
  40. package/skinny/registerListBox-d5efc5da.esm.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState, useMemo, forwardRef, useImperativeHandle, Component } from 'react';
1
+ import React, { useEffect, useCallback, useState, useMemo, forwardRef, useImperativeHandle, Component } from 'react';
2
2
  import { mergeProps, useFocusable } from 'react-aria';
3
3
  import { Button, Checkbox, Text, Label, CheckboxGroup, Input, ListBoxItem, ListBox, Section, Header, PopoverContext, Popover, ComboBox, ComboBoxStateContext, Heading, ModalOverlay, Modal, Dialog, DialogTrigger, Radio, RadioGroup, Select, SelectStateContext, SelectValue, SliderOutput, SliderThumb, Slider, SliderTrack, Switch, TextArea, TextField, TooltipTrigger, Tooltip } from 'react-aria-components';
4
4
  import { usePlasmicCanvasContext, usePlasmicCanvasComponentInfo } from '@plasmicapp/host';
@@ -554,7 +554,7 @@ const BUTTON_VARIANTS = [
554
554
  "focusVisible",
555
555
  "disabled"
556
556
  ];
557
- const { variants: variants$f, withObservedValues: withObservedValues$d } = pickAriaComponentVariants(BUTTON_VARIANTS);
557
+ const { variants: variants$g, withObservedValues: withObservedValues$d } = pickAriaComponentVariants(BUTTON_VARIANTS);
558
558
  const BaseButton = React.forwardRef(function BaseButtonInner(props, ref) {
559
559
  const _a = props, { submitsForm, resetsForm, children, plasmicUpdateVariant } = _a, rest = __objRest$m(_a, ["submitsForm", "resetsForm", "children", "plasmicUpdateVariant"]);
560
560
  const type = submitsForm ? "submit" : resetsForm ? "reset" : "button";
@@ -584,7 +584,7 @@ function registerButton(loader, overrides) {
584
584
  displayName: "Aria Button",
585
585
  importPath: "@plasmicpkgs/react-aria/skinny/registerButton",
586
586
  importName: "BaseButton",
587
- variants: variants$f,
587
+ variants: variants$g,
588
588
  defaultStyles: {
589
589
  borderWidth: "1px",
590
590
  borderStyle: "solid",
@@ -689,7 +689,7 @@ const CHECKBOX_VARIANTS = [
689
689
  "readonly",
690
690
  "selected"
691
691
  ];
692
- const { variants: variants$e, withObservedValues: withObservedValues$c } = pickAriaComponentVariants(CHECKBOX_VARIANTS);
692
+ const { variants: variants$f, withObservedValues: withObservedValues$c } = pickAriaComponentVariants(CHECKBOX_VARIANTS);
693
693
  function BaseCheckbox(props) {
694
694
  const _a = props, { children, plasmicUpdateVariant, setControlContextData } = _a, rest = __objRest$l(_a, ["children", "plasmicUpdateVariant", "setControlContextData"]);
695
695
  const contextProps = React.useContext(PlasmicCheckboxGroupContext);
@@ -776,7 +776,7 @@ function registerCheckbox(loader, overrides) {
776
776
  displayName: "Aria Checkbox",
777
777
  importPath: "@plasmicpkgs/react-aria/skinny/registerCheckbox",
778
778
  importName: "BaseCheckbox",
779
- variants: variants$e,
779
+ variants: variants$f,
780
780
  props: __spreadProps$e(__spreadValues$o({}, getCommonProps("checkbox", [
781
781
  "name",
782
782
  "isDisabled",
@@ -1042,7 +1042,7 @@ var __objRest$i = (source, exclude) => {
1042
1042
  return target;
1043
1043
  };
1044
1044
  const CHECKBOX_GROUP_VARIANTS = ["disabled", "readonly"];
1045
- const { variants: variants$d, withObservedValues: withObservedValues$b } = pickAriaComponentVariants(
1045
+ const { variants: variants$e, withObservedValues: withObservedValues$b } = pickAriaComponentVariants(
1046
1046
  CHECKBOX_GROUP_VARIANTS
1047
1047
  );
1048
1048
  function BaseCheckboxGroup(props) {
@@ -1070,7 +1070,7 @@ function registerCheckboxGroup(loader, overrides) {
1070
1070
  displayName: "Aria Checkbox Group",
1071
1071
  importPath: "@plasmicpkgs/react-aria/skinny/registerCheckboxGroup",
1072
1072
  importName: "BaseCheckboxGroup",
1073
- variants: variants$d,
1073
+ variants: variants$e,
1074
1074
  props: __spreadProps$a(__spreadValues$k({}, getCommonProps("checkbox group", [
1075
1075
  "name",
1076
1076
  "isDisabled",
@@ -1266,10 +1266,11 @@ var __objRest$h = (source, exclude) => {
1266
1266
  };
1267
1267
  const INPUT_VARIANTS = [
1268
1268
  "focused",
1269
+ "focusVisible",
1269
1270
  "hovered",
1270
1271
  "disabled"
1271
1272
  ];
1272
- const { variants: variants$c } = pickAriaComponentVariants(INPUT_VARIANTS);
1273
+ const { variants: variants$d } = pickAriaComponentVariants(INPUT_VARIANTS);
1273
1274
  const inputHelpers$1 = {
1274
1275
  states: {
1275
1276
  value: {
@@ -1280,65 +1281,47 @@ const inputHelpers$1 = {
1280
1281
  }
1281
1282
  };
1282
1283
  function BaseInput(props) {
1283
- var _b;
1284
1284
  const _a = props, {
1285
1285
  plasmicUpdateVariant,
1286
1286
  setControlContextData,
1287
- disabled,
1288
1287
  autoComplete,
1289
- value
1288
+ value,
1289
+ className
1290
1290
  } = _a, rest = __objRest$h(_a, [
1291
1291
  "plasmicUpdateVariant",
1292
1292
  "setControlContextData",
1293
- "disabled",
1294
1293
  "autoComplete",
1295
- "value"
1294
+ "value",
1295
+ "className"
1296
1296
  ]);
1297
1297
  const textFieldContext = React.useContext(PlasmicTextFieldContext);
1298
1298
  const context = React.useContext(PlasmicInputContext);
1299
1299
  setControlContextData == null ? void 0 : setControlContextData({
1300
1300
  parent: textFieldContext
1301
1301
  });
1302
- const mergedProps = mergeProps(
1303
- rest,
1304
- {
1305
- value: (context == null ? void 0 : context.isUncontrolled) ? void 0 : value
1302
+ const classNameProp = useCallback(
1303
+ ({
1304
+ isDisabled,
1305
+ isFocusVisible,
1306
+ isFocused,
1307
+ isHovered
1308
+ }) => {
1309
+ plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
1310
+ disabled: isDisabled,
1311
+ focused: isFocused,
1312
+ focusVisible: isFocusVisible,
1313
+ hovered: isHovered
1314
+ });
1315
+ return className != null ? className : "";
1306
1316
  },
1307
- {
1308
- /**
1309
- * While react-aria internally does the merging of the disabled prop,
1310
- * we need to explicity do it here, because react-aria does it behind the scenes,
1311
- * whereas we need the calculated value of the disabled prop to be able to update the "disabled" CC variant.
1312
- * */
1313
- disabled: (_b = textFieldContext == null ? void 0 : textFieldContext.isDisabled) != null ? _b : disabled
1314
- }
1315
- );
1316
- useEffect(() => {
1317
- plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
1318
- disabled: mergedProps.disabled
1319
- });
1320
- }, [mergedProps.disabled, plasmicUpdateVariant]);
1321
- return /* @__PURE__ */ React.createElement(
1322
- Input,
1323
- __spreadValues$j({
1324
- autoComplete: resolveAutoComplete(autoComplete),
1325
- onHoverChange: (isHovered) => {
1326
- plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
1327
- hovered: isHovered
1328
- });
1329
- },
1330
- onFocus: () => {
1331
- plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
1332
- focused: true
1333
- });
1334
- },
1335
- onBlur: () => {
1336
- plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
1337
- focused: false
1338
- });
1339
- }
1340
- }, mergedProps)
1317
+ [className, plasmicUpdateVariant]
1341
1318
  );
1319
+ const mergedProps = mergeProps(rest, {
1320
+ value: (context == null ? void 0 : context.isUncontrolled) ? void 0 : value,
1321
+ autoComplete: resolveAutoComplete(autoComplete),
1322
+ className: classNameProp
1323
+ });
1324
+ return /* @__PURE__ */ React.createElement(Input, __spreadValues$j({}, mergedProps));
1342
1325
  }
1343
1326
  const INPUT_COMPONENT_NAME = makeComponentName("input");
1344
1327
  function registerInput(loader, overrides) {
@@ -1350,7 +1333,7 @@ function registerInput(loader, overrides) {
1350
1333
  displayName: "Aria Input",
1351
1334
  importPath: "@plasmicpkgs/react-aria/skinny/registerInput",
1352
1335
  importName: "BaseInput",
1353
- variants: variants$c,
1336
+ variants: variants$d,
1354
1337
  defaultStyles: {
1355
1338
  width: "300px",
1356
1339
  borderWidth: "1px",
@@ -1442,7 +1425,7 @@ const LIST_BOX_ITEM_VARIANTS = [
1442
1425
  "selected",
1443
1426
  "disabled"
1444
1427
  ];
1445
- const { variants: variants$b, withObservedValues: withObservedValues$a } = pickAriaComponentVariants(
1428
+ const { variants: variants$c, withObservedValues: withObservedValues$a } = pickAriaComponentVariants(
1446
1429
  LIST_BOX_ITEM_VARIANTS
1447
1430
  );
1448
1431
  function BaseListBoxItem(props) {
@@ -1548,7 +1531,7 @@ function registerListBoxItem(loader, overrides) {
1548
1531
  displayName: "Aria ListBoxItem",
1549
1532
  importPath: "@plasmicpkgs/react-aria/skinny/registerListBoxItem",
1550
1533
  importName: "BaseListBoxItem",
1551
- variants: variants$b,
1534
+ variants: variants$c,
1552
1535
  props: {
1553
1536
  id: {
1554
1537
  type: "string",
@@ -1684,6 +1667,8 @@ var __objRest$e = (source, exclude) => {
1684
1667
  }
1685
1668
  return target;
1686
1669
  };
1670
+ const LISTBOX_VARIANTS = ["focused", "focusVisible"];
1671
+ const { variants: variants$b } = pickAriaComponentVariants(LISTBOX_VARIANTS);
1687
1672
  const listboxHelpers = {
1688
1673
  states: {
1689
1674
  selectedValue: {
@@ -1700,13 +1685,17 @@ function BaseListBox(props) {
1700
1685
  const _a = props, {
1701
1686
  setControlContextData,
1702
1687
  children,
1688
+ className,
1703
1689
  selectedKeys,
1704
- defaultSelectedKeys
1690
+ defaultSelectedKeys,
1691
+ plasmicUpdateVariant
1705
1692
  } = _a, rest = __objRest$e(_a, [
1706
1693
  "setControlContextData",
1707
1694
  "children",
1695
+ "className",
1708
1696
  "selectedKeys",
1709
- "defaultSelectedKeys"
1697
+ "defaultSelectedKeys",
1698
+ "plasmicUpdateVariant"
1710
1699
  ]);
1711
1700
  const context = React.useContext(PlasmicListBoxContext);
1712
1701
  const isStandalone = !context;
@@ -1729,11 +1718,22 @@ function BaseListBox(props) {
1729
1718
  setIds(_ids);
1730
1719
  });
1731
1720
  }, []);
1721
+ const classNameProp = useCallback(
1722
+ ({ isFocusVisible, isFocused }) => {
1723
+ plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
1724
+ focused: isFocused,
1725
+ focusVisible: isFocusVisible
1726
+ });
1727
+ return className != null ? className : "";
1728
+ },
1729
+ [className, plasmicUpdateVariant]
1730
+ );
1732
1731
  const listbox = /* @__PURE__ */ React.createElement(
1733
1732
  ListBox,
1734
1733
  __spreadValues$g({
1735
1734
  selectedKeys: normalizeSelectedKeys(selectedKeys),
1736
- defaultSelectedKeys: normalizeSelectedKeys(defaultSelectedKeys)
1735
+ defaultSelectedKeys: normalizeSelectedKeys(defaultSelectedKeys),
1736
+ className: classNameProp
1737
1737
  }, rest),
1738
1738
  children
1739
1739
  );
@@ -1815,6 +1815,7 @@ function registerListBox(loader, overrides) {
1815
1815
  displayName: "Aria ListBox",
1816
1816
  importPath: "@plasmicpkgs/react-aria/skinny/registerListBox",
1817
1817
  importName: "BaseListBox",
1818
+ variants: variants$b,
1818
1819
  defaultStyles: {
1819
1820
  width: "250px",
1820
1821
  borderWidth: "1px",
@@ -2159,16 +2160,23 @@ function BaseComboBox(props) {
2159
2160
  setControlContextData,
2160
2161
  plasmicUpdateVariant,
2161
2162
  className,
2162
- isDisabled,
2163
2163
  isOpen: _isOpen
2164
2164
  } = _a, rest = __objRest$c(_a, [
2165
2165
  "children",
2166
2166
  "setControlContextData",
2167
2167
  "plasmicUpdateVariant",
2168
2168
  "className",
2169
- "isDisabled",
2170
2169
  "isOpen"
2171
2170
  ]);
2171
+ const classNameProp = useCallback(
2172
+ ({ isDisabled }) => {
2173
+ plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
2174
+ disabled: isDisabled
2175
+ });
2176
+ return className != null ? className : "";
2177
+ },
2178
+ [className, plasmicUpdateVariant]
2179
+ );
2172
2180
  const idManager = useMemo(() => new ListBoxItemIdManager(), []);
2173
2181
  useEffect(() => {
2174
2182
  idManager.subscribe((ids) => {
@@ -2177,27 +2185,15 @@ function BaseComboBox(props) {
2177
2185
  });
2178
2186
  });
2179
2187
  }, []);
2180
- useEffect(() => {
2181
- plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
2182
- disabled: isDisabled
2183
- });
2184
- }, [isDisabled, plasmicUpdateVariant]);
2185
- return /* @__PURE__ */ React.createElement(
2186
- ComboBox,
2187
- __spreadValues$e({
2188
- isDisabled,
2189
- className
2190
- }, rest),
2191
- /* @__PURE__ */ React.createElement(PlasmicPopoverTriggerContext.Provider, { value: true }, /* @__PURE__ */ React.createElement(
2192
- PlasmicListBoxContext.Provider,
2193
- {
2194
- value: {
2195
- idManager
2196
- }
2197
- },
2198
- /* @__PURE__ */ React.createElement(PlasmicInputContext.Provider, { value: { isUncontrolled: true } }, /* @__PURE__ */ React.createElement(ComboboxAutoOpen, __spreadValues$e({}, props)), children)
2199
- ))
2200
- );
2188
+ return /* @__PURE__ */ React.createElement(ComboBox, __spreadValues$e({ className: classNameProp }, rest), /* @__PURE__ */ React.createElement(PlasmicPopoverTriggerContext.Provider, { value: true }, /* @__PURE__ */ React.createElement(
2189
+ PlasmicListBoxContext.Provider,
2190
+ {
2191
+ value: {
2192
+ idManager
2193
+ }
2194
+ },
2195
+ /* @__PURE__ */ React.createElement(PlasmicInputContext.Provider, { value: { isUncontrolled: true } }, /* @__PURE__ */ React.createElement(ComboboxAutoOpen, __spreadValues$e({}, props)), children)
2196
+ )));
2201
2197
  }
2202
2198
  function registerComboBox(loader) {
2203
2199
  registerComponentHelper(loader, BaseComboBox, {
@@ -3068,7 +3064,11 @@ const BaseSelectValue = (props) => {
3068
3064
  return /* @__PURE__ */ React.createElement(SelectValue, { className }, ({ isPlaceholder, selectedText }) => /* @__PURE__ */ React.createElement(React.Fragment, null, isPlaceholder ? placeholder : selectedText));
3069
3065
  };
3070
3066
  const SELECT_NAME = makeComponentName("select");
3071
- const SELECT_VARIANTS = ["disabled"];
3067
+ const SELECT_VARIANTS = [
3068
+ "focused",
3069
+ "focusVisible",
3070
+ "disabled"
3071
+ ];
3072
3072
  const { variants: SELECT_VARIANTS_DATA } = pickAriaComponentVariants(SELECT_VARIANTS);
3073
3073
  function BaseSelect(props) {
3074
3074
  const {
@@ -3093,11 +3093,21 @@ function BaseSelect(props) {
3093
3093
  });
3094
3094
  });
3095
3095
  }, []);
3096
- useEffect(() => {
3097
- plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
3098
- disabled: isDisabled
3099
- });
3100
- }, [isDisabled, plasmicUpdateVariant]);
3096
+ const classNameProp = useCallback(
3097
+ ({
3098
+ isDisabled: isDisabled2,
3099
+ isFocusVisible,
3100
+ isFocused
3101
+ }) => {
3102
+ plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
3103
+ disabled: isDisabled2,
3104
+ focused: isFocused,
3105
+ focusVisible: isFocusVisible
3106
+ });
3107
+ return className != null ? className : "";
3108
+ },
3109
+ [className, plasmicUpdateVariant]
3110
+ );
3101
3111
  return /* @__PURE__ */ React.createElement(
3102
3112
  Select,
3103
3113
  __spreadValues$8({
@@ -3105,7 +3115,7 @@ function BaseSelect(props) {
3105
3115
  onSelectionChange,
3106
3116
  onOpenChange,
3107
3117
  isDisabled,
3108
- className,
3118
+ className: classNameProp,
3109
3119
  style,
3110
3120
  name,
3111
3121
  disabledKeys,
@@ -4185,6 +4195,7 @@ var __objRest$1 = (source, exclude) => {
4185
4195
  };
4186
4196
  const TEXTAREA_VARIANTS = [
4187
4197
  "focused",
4198
+ "focusVisible",
4188
4199
  "hovered",
4189
4200
  "disabled"
4190
4201
  ];
@@ -4199,40 +4210,32 @@ const inputHelpers = {
4199
4210
  }
4200
4211
  };
4201
4212
  function BaseTextArea(props) {
4202
- var _b;
4203
- const _a = props, { disabled, plasmicUpdateVariant, setControlContextData } = _a, rest = __objRest$1(_a, ["disabled", "plasmicUpdateVariant", "setControlContextData"]);
4213
+ const _a = props, { className, plasmicUpdateVariant, setControlContextData } = _a, rest = __objRest$1(_a, ["className", "plasmicUpdateVariant", "setControlContextData"]);
4204
4214
  const textFieldContext = React.useContext(PlasmicTextFieldContext);
4205
- const mergedProps = mergeProps(rest, {
4206
- disabled: (_b = textFieldContext == null ? void 0 : textFieldContext.isDisabled) != null ? _b : disabled
4207
- });
4208
- useEffect(() => {
4209
- plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
4210
- disabled: mergedProps.disabled
4211
- });
4212
- }, [mergedProps.disabled, plasmicUpdateVariant]);
4213
4215
  setControlContextData == null ? void 0 : setControlContextData({
4214
4216
  parent: textFieldContext
4215
4217
  });
4216
- return /* @__PURE__ */ React.createElement(
4217
- TextArea,
4218
- __spreadValues$2({
4219
- onFocus: () => {
4220
- plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
4221
- focused: true
4222
- });
4223
- },
4224
- onBlur: () => {
4225
- plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
4226
- focused: false
4227
- });
4228
- },
4229
- onHoverChange: (isHovered) => {
4230
- plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
4231
- hovered: isHovered
4232
- });
4233
- }
4234
- }, mergedProps)
4218
+ const classNameProp = useCallback(
4219
+ ({
4220
+ isDisabled,
4221
+ isFocusVisible,
4222
+ isFocused,
4223
+ isHovered
4224
+ }) => {
4225
+ plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
4226
+ disabled: isDisabled,
4227
+ focused: isFocused,
4228
+ focusVisible: isFocusVisible,
4229
+ hovered: isHovered
4230
+ });
4231
+ return className != null ? className : "";
4232
+ },
4233
+ [className, plasmicUpdateVariant]
4235
4234
  );
4235
+ const mergedProps = mergeProps(rest, {
4236
+ className: classNameProp
4237
+ });
4238
+ return /* @__PURE__ */ React.createElement(TextArea, __spreadValues$2({}, mergedProps));
4236
4239
  }
4237
4240
  function registerTextArea(loader, overrides) {
4238
4241
  registerComponentHelper(