@doist/reactist 12.0.2 → 12.1.0

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 (65) hide show
  1. package/README.md +2 -0
  2. package/dist/reactist.cjs.development.js +99 -32
  3. package/dist/reactist.cjs.development.js.map +1 -1
  4. package/dist/reactist.cjs.production.min.js +1 -1
  5. package/dist/reactist.cjs.production.min.js.map +1 -1
  6. package/es/components/menu/menu.js +3 -2
  7. package/es/components/menu/menu.js.map +1 -1
  8. package/es/new-components/base-field/base-field.js +60 -16
  9. package/es/new-components/base-field/base-field.js.map +1 -1
  10. package/es/new-components/base-field/base-field.module.css.js +1 -1
  11. package/es/new-components/password-field/password-field.js +8 -2
  12. package/es/new-components/password-field/password-field.js.map +1 -1
  13. package/es/new-components/password-field/password-field.module.css.js +1 -1
  14. package/es/new-components/select-field/select-field.js +6 -2
  15. package/es/new-components/select-field/select-field.js.map +1 -1
  16. package/es/new-components/select-field/select-field.module.css.js +1 -1
  17. package/es/new-components/text/text.module.css.js +1 -1
  18. package/es/new-components/text-area/text-area.js +10 -3
  19. package/es/new-components/text-area/text-area.js.map +1 -1
  20. package/es/new-components/text-area/text-area.module.css.js +1 -1
  21. package/es/new-components/text-field/text-field.js +8 -2
  22. package/es/new-components/text-field/text-field.js.map +1 -1
  23. package/es/new-components/text-field/text-field.module.css.js +1 -1
  24. package/lib/components/menu/menu.d.ts +2 -1
  25. package/lib/components/menu/menu.js +1 -1
  26. package/lib/components/menu/menu.js.map +1 -1
  27. package/lib/new-components/base-field/base-field.d.ts +66 -9
  28. package/lib/new-components/base-field/base-field.js +1 -1
  29. package/lib/new-components/base-field/base-field.js.map +1 -1
  30. package/lib/new-components/base-field/base-field.module.css.js +1 -1
  31. package/lib/new-components/password-field/password-field.d.ts +3 -2
  32. package/lib/new-components/password-field/password-field.js +1 -1
  33. package/lib/new-components/password-field/password-field.js.map +1 -1
  34. package/lib/new-components/password-field/password-field.module.css.js +1 -1
  35. package/lib/new-components/select-field/select-field.d.ts +1 -1
  36. package/lib/new-components/select-field/select-field.js +1 -1
  37. package/lib/new-components/select-field/select-field.js.map +1 -1
  38. package/lib/new-components/select-field/select-field.module.css.js +1 -1
  39. package/lib/new-components/switch-field/switch-field.d.ts +1 -1
  40. package/lib/new-components/text/text.module.css.js +1 -1
  41. package/lib/new-components/text-area/text-area.d.ts +3 -3
  42. package/lib/new-components/text-area/text-area.js +1 -1
  43. package/lib/new-components/text-area/text-area.js.map +1 -1
  44. package/lib/new-components/text-area/text-area.module.css.js +1 -1
  45. package/lib/new-components/text-field/text-field.d.ts +3 -2
  46. package/lib/new-components/text-field/text-field.js +1 -1
  47. package/lib/new-components/text-field/text-field.js.map +1 -1
  48. package/lib/new-components/text-field/text-field.module.css.js +1 -1
  49. package/package.json +1 -1
  50. package/styles/base-field.css +4 -3
  51. package/styles/base-field.module.css.css +1 -1
  52. package/styles/checkbox-field.css +1 -1
  53. package/styles/menu.css +1 -1
  54. package/styles/password-field.css +5 -4
  55. package/styles/password-field.module.css.css +1 -1
  56. package/styles/reactist.css +8 -8
  57. package/styles/select-field.css +4 -3
  58. package/styles/select-field.module.css.css +1 -1
  59. package/styles/switch-field.css +3 -2
  60. package/styles/text-area.css +4 -3
  61. package/styles/text-area.module.css.css +1 -1
  62. package/styles/text-field.css +4 -3
  63. package/styles/text-field.module.css.css +1 -1
  64. package/styles/text.css +1 -1
  65. package/styles/text.module.css.css +1 -1
package/README.md CHANGED
@@ -151,3 +151,5 @@ npm --no-git-tag-version version <major|minor|patch>
151
151
  Once these changes have been pushed and merged, create a release.
152
152
 
153
153
  A GitHub Action will automatically perform all the necessary steps and will release the version number that's specified inside the `package.json`'s `version` field so make sure that the release tag reflects the version you want to publish.
154
+
155
+ Finally, once the release has been created be sure to update both [todoist-web](https://github.com/Doist/todoist-web) and [twist-web](https://github.com/Doist/twist-web) to use the new version.
@@ -886,7 +886,7 @@ const Heading = /*#__PURE__*/React.forwardRef(function Heading(_ref, ref) {
886
886
  }), children);
887
887
  });
888
888
 
889
- var modules_a9637dd3 = {"text":"_2282cb83","size-caption":"_087a8179","size-copy":"a4423c2a","size-subtitle":"_03365a63","weight-semibold":"_5213e4ab","weight-bold":"_3d58c8f2","tone-secondary":"_892a359a","tone-danger":"f9cb5d8a","tone-positive":"fcedb234","lineClampMultipleLines":"_765949c1","lineClamp-1":"c3e4800e","lineClamp-2":"b25b652b","lineClamp-3":"bb13d214","lineClamp-4":"_6db1928e","lineClamp-5":"e9944c1d"};
889
+ var modules_a9637dd3 = {"text":"a83bd4e0","size-caption":"_266d6623","size-copy":"a8d37c6e","size-subtitle":"_39f4eb1f","weight-semibold":"_7be5c531","weight-bold":"e214ff2e","tone-secondary":"_6a3e5ade","tone-danger":"_8f5b5f2b","tone-positive":"_9ae47ae4","lineClampMultipleLines":"_969f18f7","lineClamp-1":"_2f303ac3","lineClamp-2":"d3e04245","lineClamp-3":"_33411704","lineClamp-4":"bfc32640","lineClamp-5":"f813c82f"};
890
890
 
891
891
  const _excluded$c = ["as", "size", "weight", "tone", "align", "children", "lineClamp", "exceptionallySetClassName"];
892
892
  const Text = /*#__PURE__*/polymorphicComponent(function Text(_ref, ref) {
@@ -1116,7 +1116,7 @@ function useId(providedId) {
1116
1116
  return ref.current;
1117
1117
  }
1118
1118
 
1119
- var modules_540a88ff = {"container":"ed7d894c","primaryLabel":"_22213081","secondaryLabel":"be8637dd","auxiliaryLabel":"_72b46ad5"};
1119
+ var modules_540a88ff = {"container":"_2e189908","auxiliaryLabel":"_83051e0a","bordered":"fd20ef50","error":"d1a17d92","primaryLabel":"_75e0afa0","secondaryLabel":"d04a867d","messageIcon":"_77b2107e"};
1120
1120
 
1121
1121
  function FieldHint(props) {
1122
1122
  return /*#__PURE__*/React.createElement(Text, _objectSpread2({
@@ -1126,11 +1126,52 @@ function FieldHint(props) {
1126
1126
  }, props));
1127
1127
  }
1128
1128
 
1129
+ function MessageIcon(props) {
1130
+ return /*#__PURE__*/React.createElement("svg", _objectSpread2({
1131
+ width: "16",
1132
+ height: "16",
1133
+ viewBox: "0 0 16 16",
1134
+ fill: "none",
1135
+ xmlns: "http://www.w3.org/2000/svg"
1136
+ }, props), /*#__PURE__*/React.createElement("path", {
1137
+ fillRule: "evenodd",
1138
+ clipRule: "evenodd",
1139
+ d: "M8 2.5C4.96243 2.5 2.5 4.96243 2.5 8C2.5 11.0376 4.96243 13.5 8 13.5C11.0376 13.5 13.5 11.0376 13.5 8C13.5 4.96243 11.0376 2.5 8 2.5ZM1.5 8C1.5 4.41015 4.41015 1.5 8 1.5C11.5899 1.5 14.5 4.41015 14.5 8C14.5 11.5899 11.5899 14.5 8 14.5C4.41015 14.5 1.5 11.5899 1.5 8ZM8.66667 10.3333C8.66667 10.7015 8.36819 11 8 11C7.63181 11 7.33333 10.7015 7.33333 10.3333C7.33333 9.96514 7.63181 9.66667 8 9.66667C8.36819 9.66667 8.66667 9.96514 8.66667 10.3333ZM8.65766 5.65766C8.65766 5.29445 8.36322 5 8 5C7.99087 5.00008 7.98631 5.00013 7.98175 5.00025C7.97719 5.00038 7.97263 5.00059 7.96352 5.00101C7.60086 5.02116 7.3232 5.33149 7.34335 5.69415L7.50077 8.52774C7.53575 9.15742 8.46425 9.15742 8.49923 8.52774L8.65665 5.69415C8.65707 5.68503 8.65728 5.68047 8.65741 5.67591C8.65754 5.67135 8.65758 5.66679 8.65766 5.65766Z",
1140
+ fill: "currentColor"
1141
+ }));
1142
+ }
1143
+
1144
+ function FieldMessage({
1145
+ id,
1146
+ children,
1147
+ tone
1148
+ }) {
1149
+ const textTone = tone === 'error' ? 'danger' : tone === 'success' ? 'positive' : 'normal';
1150
+ return /*#__PURE__*/React.createElement(Text, {
1151
+ as: "p",
1152
+ tone: textTone,
1153
+ size: "copy",
1154
+ id: id
1155
+ }, /*#__PURE__*/React.createElement(Box, {
1156
+ as: "span",
1157
+ marginRight: "xsmall",
1158
+ display: "inlineFlex",
1159
+ className: modules_540a88ff.messageIcon
1160
+ }, tone === 'loading' ? /*#__PURE__*/React.createElement(Spinner, {
1161
+ size: 16
1162
+ }) : /*#__PURE__*/React.createElement(MessageIcon, {
1163
+ "aria-hidden": true
1164
+ })), children);
1165
+ }
1166
+
1129
1167
  function BaseField({
1168
+ variant = 'default',
1130
1169
  label,
1131
1170
  secondaryLabel,
1132
1171
  auxiliaryLabel,
1133
1172
  hint,
1173
+ message,
1174
+ tone = 'neutral',
1134
1175
  className,
1135
1176
  children,
1136
1177
  maxWidth,
@@ -1140,21 +1181,26 @@ function BaseField({
1140
1181
  }) {
1141
1182
  const id = useId(originalId);
1142
1183
  const hintId = useId();
1143
- const ariaDescribedBy = originalAriaDescribedBy != null ? originalAriaDescribedBy : hint ? hintId : undefined;
1184
+ const messageId = useId();
1185
+ const ariaDescribedBy = originalAriaDescribedBy != null ? originalAriaDescribedBy : [message ? messageId : null, hintId].filter(Boolean).join(' ');
1186
+ const childrenProps = {
1187
+ id,
1188
+ 'aria-describedby': ariaDescribedBy,
1189
+ 'aria-invalid': tone === 'error' ? true : undefined
1190
+ };
1144
1191
  return /*#__PURE__*/React.createElement(Stack, {
1145
- space: "small"
1146
- }, /*#__PURE__*/React.createElement(Box, {
1147
- className: [className, modules_540a88ff.container],
1148
- maxWidth: maxWidth,
1192
+ space: "small",
1149
1193
  hidden: hidden
1194
+ }, /*#__PURE__*/React.createElement(Box, {
1195
+ className: [className, modules_540a88ff.container, tone === 'error' ? modules_540a88ff.error : null, variant === 'bordered' ? modules_540a88ff.bordered : null],
1196
+ maxWidth: maxWidth
1150
1197
  }, /*#__PURE__*/React.createElement(Box, {
1151
1198
  as: "span",
1152
1199
  display: "flex",
1153
1200
  justifyContent: "spaceBetween",
1154
- alignItems: "flexEnd",
1155
- paddingBottom: "small"
1201
+ alignItems: "flexEnd"
1156
1202
  }, /*#__PURE__*/React.createElement(Text, {
1157
- size: "body",
1203
+ size: variant === 'bordered' ? 'caption' : 'body',
1158
1204
  as: "label",
1159
1205
  htmlFor: id
1160
1206
  }, label ? /*#__PURE__*/React.createElement("span", {
@@ -1164,13 +1210,10 @@ function BaseField({
1164
1210
  }, "\u00A0(", secondaryLabel, ")") : null), auxiliaryLabel ? /*#__PURE__*/React.createElement(Box, {
1165
1211
  className: modules_540a88ff.auxiliaryLabel,
1166
1212
  paddingLeft: "small"
1167
- }, auxiliaryLabel) : null), children(ariaDescribedBy ? {
1168
- id,
1169
- 'aria-describedby': ariaDescribedBy
1170
- } : {
1171
- id
1172
- })), hint ? /*#__PURE__*/React.createElement(FieldHint, {
1173
- hidden: hidden,
1213
+ }, auxiliaryLabel) : null), children(childrenProps)), message ? /*#__PURE__*/React.createElement(FieldMessage, {
1214
+ id: messageId,
1215
+ tone: tone
1216
+ }, message) : null, hint ? /*#__PURE__*/React.createElement(FieldHint, {
1174
1217
  id: hintId
1175
1218
  }, hint) : null);
1176
1219
  }
@@ -1218,17 +1261,20 @@ function PasswordHiddenIcon(props) {
1218
1261
  })));
1219
1262
  }
1220
1263
 
1221
- var modules_3f03ead6 = {"inputWrapper":"_460d581b"};
1264
+ var modules_3f03ead6 = {"inputWrapper":"_66b448b3"};
1222
1265
 
1223
- var modules_aaf25250 = {"inputWrapper":"dd9ffeab"};
1266
+ var modules_aaf25250 = {"inputWrapper":"a3ecd1c5","bordered":"_5e6ce80b","error":"_1d92e043"};
1224
1267
 
1225
- const _excluded$h = ["label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth", "togglePasswordLabel", "hidden", "aria-describedby"];
1268
+ const _excluded$h = ["variant", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "togglePasswordLabel", "hidden", "aria-describedby"];
1226
1269
  const PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref, ref) {
1227
1270
  let {
1271
+ variant = 'default',
1228
1272
  label,
1229
1273
  secondaryLabel,
1230
1274
  auxiliaryLabel,
1231
1275
  hint,
1276
+ message,
1277
+ tone,
1232
1278
  maxWidth,
1233
1279
  togglePasswordLabel = 'Toggle password visibility',
1234
1280
  hidden,
@@ -1249,18 +1295,21 @@ const PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref,
1249
1295
  }
1250
1296
 
1251
1297
  return /*#__PURE__*/React.createElement(BaseField, {
1298
+ variant: variant,
1252
1299
  id: id,
1253
1300
  label: label,
1254
1301
  secondaryLabel: secondaryLabel,
1255
1302
  auxiliaryLabel: auxiliaryLabel,
1256
1303
  hint: hint,
1304
+ message: message,
1305
+ tone: tone,
1257
1306
  maxWidth: maxWidth,
1258
1307
  hidden: hidden,
1259
1308
  "aria-describedby": ariaDescribedBy
1260
1309
  }, extraProps => /*#__PURE__*/React.createElement(Box, {
1261
1310
  display: "flex",
1262
1311
  alignItems: "center",
1263
- className: [modules_3f03ead6.inputWrapper, modules_aaf25250.inputWrapper]
1312
+ className: [modules_3f03ead6.inputWrapper, modules_aaf25250.inputWrapper, tone === 'error' ? modules_aaf25250.error : null, variant === 'bordered' ? modules_aaf25250.bordered : null]
1264
1313
  }, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2(_objectSpread2({}, props), extraProps), {}, {
1265
1314
  ref: inputRef,
1266
1315
  type: isPasswordVisible ? 'text' : 'password'
@@ -1278,9 +1327,9 @@ const PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref,
1278
1327
  })))));
1279
1328
  });
1280
1329
 
1281
- var modules_1fa9b208 = {"selectWrapper":"_828e09c5"};
1330
+ var modules_1fa9b208 = {"selectWrapper":"_07e75293","error":"f147bcea"};
1282
1331
 
1283
- const _excluded$i = ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth", "children", "hidden", "aria-describedby"];
1332
+ const _excluded$i = ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "children", "hidden", "aria-describedby"];
1284
1333
  const SelectField = /*#__PURE__*/React.forwardRef(function SelectField(_ref, ref) {
1285
1334
  let {
1286
1335
  id,
@@ -1288,6 +1337,8 @@ const SelectField = /*#__PURE__*/React.forwardRef(function SelectField(_ref, ref
1288
1337
  secondaryLabel,
1289
1338
  auxiliaryLabel,
1290
1339
  hint,
1340
+ message,
1341
+ tone,
1291
1342
  maxWidth,
1292
1343
  children,
1293
1344
  hidden,
@@ -1301,11 +1352,13 @@ const SelectField = /*#__PURE__*/React.forwardRef(function SelectField(_ref, ref
1301
1352
  secondaryLabel: secondaryLabel,
1302
1353
  auxiliaryLabel: auxiliaryLabel,
1303
1354
  hint: hint,
1355
+ message: message,
1356
+ tone: tone,
1304
1357
  maxWidth: maxWidth,
1305
1358
  hidden: hidden,
1306
1359
  "aria-describedby": ariaDescribedBy
1307
1360
  }, extraProps => /*#__PURE__*/React.createElement(Box, {
1308
- className: modules_1fa9b208.selectWrapper
1361
+ className: [modules_1fa9b208.selectWrapper, tone === 'error' ? modules_1fa9b208.error : null]
1309
1362
  }, /*#__PURE__*/React.createElement("select", _objectSpread2(_objectSpread2(_objectSpread2({}, props), extraProps), {}, {
1310
1363
  ref: ref
1311
1364
  }), children), /*#__PURE__*/React.createElement(SelectChevron, {
@@ -1401,42 +1454,52 @@ const SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref
1401
1454
  }, hint) : null);
1402
1455
  });
1403
1456
 
1404
- var modules_2728c236 = {"container":"_5a579f96"};
1457
+ var modules_2728c236 = {"container":"d6ec37c5","bordered":"a60d6043","error":"bef49c61"};
1405
1458
 
1406
- const _excluded$k = ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth"];
1459
+ const _excluded$k = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth"];
1407
1460
 
1408
1461
  function TextArea(_ref) {
1409
1462
  let {
1463
+ variant = 'default',
1410
1464
  id,
1411
1465
  label,
1412
1466
  secondaryLabel,
1413
1467
  auxiliaryLabel,
1414
1468
  hint,
1469
+ message,
1470
+ tone,
1415
1471
  maxWidth
1416
1472
  } = _ref,
1417
1473
  props = _objectWithoutProperties(_ref, _excluded$k);
1418
1474
 
1419
1475
  return /*#__PURE__*/React.createElement(BaseField, {
1476
+ variant: variant,
1420
1477
  id: id,
1421
1478
  label: label,
1422
1479
  secondaryLabel: secondaryLabel,
1423
1480
  auxiliaryLabel: auxiliaryLabel,
1424
1481
  hint: hint,
1425
- className: modules_2728c236.container,
1482
+ message: message,
1483
+ tone: tone,
1484
+ className: [modules_2728c236.container, tone === 'error' ? modules_2728c236.error : null, variant === 'bordered' ? modules_2728c236.bordered : null],
1426
1485
  maxWidth: maxWidth
1427
1486
  }, extraProps => /*#__PURE__*/React.createElement(Box, {
1428
- width: "full"
1487
+ width: "full",
1488
+ display: "flex"
1429
1489
  }, /*#__PURE__*/React.createElement("textarea", _objectSpread2(_objectSpread2({}, props), extraProps))));
1430
1490
  }
1431
1491
 
1432
- const _excluded$l = ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "type", "maxWidth", "hidden", "aria-describedby"];
1492
+ const _excluded$l = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "type", "maxWidth", "hidden", "aria-describedby"];
1433
1493
  const TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
1434
1494
  let {
1495
+ variant = 'default',
1435
1496
  id,
1436
1497
  label,
1437
1498
  secondaryLabel,
1438
1499
  auxiliaryLabel,
1439
1500
  hint,
1501
+ message,
1502
+ tone,
1440
1503
  type = 'text',
1441
1504
  maxWidth,
1442
1505
  hidden,
@@ -1445,16 +1508,19 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
1445
1508
  props = _objectWithoutProperties(_ref, _excluded$l);
1446
1509
 
1447
1510
  return /*#__PURE__*/React.createElement(BaseField, {
1511
+ variant: variant,
1448
1512
  id: id,
1449
1513
  label: label,
1450
1514
  secondaryLabel: secondaryLabel,
1451
1515
  auxiliaryLabel: auxiliaryLabel,
1452
1516
  hint: hint,
1517
+ message: message,
1518
+ tone: tone,
1453
1519
  maxWidth: maxWidth,
1454
1520
  hidden: hidden,
1455
1521
  "aria-describedby": ariaDescribedBy
1456
1522
  }, extraProps => /*#__PURE__*/React.createElement(Box, {
1457
- className: modules_aaf25250.inputWrapper
1523
+ className: [modules_aaf25250.inputWrapper, tone === 'error' ? modules_aaf25250.error : null, variant === 'bordered' ? modules_aaf25250.bordered : null]
1458
1524
  }, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2(_objectSpread2({}, props), extraProps), {}, {
1459
1525
  type: type,
1460
1526
  ref: ref
@@ -3160,7 +3226,8 @@ const MenuContext = /*#__PURE__*/React.createContext( // Ariakit gives us no mea
3160
3226
  {});
3161
3227
  /**
3162
3228
  * Wrapper component to control a menu. It does not render anything, only providing the state
3163
- * management for the menu components inside it.
3229
+ * management for the menu components inside it. Note that if you are relying on the `[role='menu']`
3230
+ * attribute to style the menu list, it is applied a `menubar` role instead in Safari.
3164
3231
  */
3165
3232
 
3166
3233
  function Menu(_ref) {
@@ -3173,7 +3240,7 @@ function Menu(_ref) {
3173
3240
  const state = Ariakit.useMenuState(_objectSpread2({
3174
3241
  focusLoop: true,
3175
3242
  gutter: 8,
3176
- shift: 8
3243
+ shift: 4
3177
3244
  }, props));
3178
3245
  const handleItemSelect = React.useCallback(function handleItemSelect(value) {
3179
3246
  if (onItemSelect) onItemSelect(value);