@doist/reactist 27.2.1 → 27.3.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.
package/README.md CHANGED
@@ -203,58 +203,36 @@ When you open a GitHub PR, you'll notice the "UI Review" and "UI Tests" CI steps
203
203
 
204
204
  # Releasing
205
205
 
206
- A new version of reactist is published both on npm and GitHub Package Registry whenever a new release on GitHub is created.
207
-
208
- ## Before merging your changes
209
-
210
- In the GitHub PR that contains your new changes, make sure that you also include the following:
211
-
212
- 1. Add tests for bugs and new feature
213
-
214
- 2. Update relevant docs (storybooks, readme)
215
-
216
- 3. Execute:
217
-
218
- ```sh
219
- npm run validate
220
- ```
221
-
222
- and make sure no errors nor warnings are shown
223
-
224
- 4. Describe your changes in [`CHANGELOG.md`](CHANGELOG.md)
225
-
226
- 5. Bump the version in [`package.json`](package.json) and [`package-lock.json`](package-lock.json) by running:
227
-
228
- ```sh
229
- npm --no-git-tag-version version <major|minor|patch>
230
- ```
231
-
232
- [ref](https://docs.npmjs.com/cli/v6/commands/npm-version)
233
-
234
- Note that the steps above are also documented in the [PR template](.github/PULL_REQUEST_TEMPLATE.md) that you will be prompted with whenever you open a new reactist GitHub PR.
235
-
236
- ## After merging your changes
237
-
238
- Once your changes have been merged to `main`, create a new GitHub release:
239
-
240
- 1. Visit https://github.com/Doist/reactist/releases/new
241
-
242
- 2. In the "Choose a tag" dropdown, type the new release version (i.e. vX.Y.Z) and select "Create new tag: vX.Y.Z on publish"
243
-
244
- 3. In the "Release title" field, type the new release version (i.e. vX.Y.Z)
245
-
246
- 4. In the "Describe the release" box, paste the same content you added to the [`CHANGELOG.md`](CHANGELOG.md), but without the title header
247
-
248
- 5. Make sure the "Set as the latest release" checkbox is checked
249
-
250
- 6. Click "Publish release"
251
-
252
- 7. Visit https://github.com/Doist/reactist/actions
253
-
254
- 8. Make sure that a new GitHub action is now running (this will automatically perform all the necessary steps to publish the package)
255
-
256
- 9. Once the action is complete, check https://npmjs.com/package/@doist/reactist and verify that there's a new public release
257
-
258
- Finally, 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 reactist version you just published.
259
-
260
- The storybook hosted on GitHub pages will be automatically updated on each push to `main`. Should there be a problem, try running the action manually from the [Actions settings](https://github.com/Doist/reactist/actions).
206
+ This project uses [release-please](https://github.com/googleapis/release-please) to automate version management and package publishing.
207
+
208
+ ## How it works
209
+
210
+ 1. Make your changes using [Conventional Commits](https://www.conventionalcommits.org/):
211
+
212
+ - `feat:` for new features (minor version bump)
213
+ - `fix:` for bug fixes (patch version bump)
214
+ - `style:` for code style changes
215
+ - `perf:` for performance improvements
216
+ - `refactor:` for refactoring code
217
+ - `test:` for adding/updating tests
218
+ - `build:` for build/dependency changes
219
+ - `docs:` for documentation changes
220
+ - `ci:` for CI changes
221
+ - `revert:` for reverting previous commits
222
+ - `feat!:` or `fix!:` for breaking changes (major version bump)
223
+ - `chore:` for maintenance tasks (NOTE: these are not included in the changelog)
224
+
225
+ 2. When commits are pushed to `main`:
226
+
227
+ - Release-please automatically creates/updates a release PR
228
+ - The PR includes version bump and changelog updates
229
+ - Review the PR and merge when ready
230
+
231
+ 3. After merging the release PR:
232
+ - A new GitHub release is automatically created
233
+ - A new tag is created
234
+ - The `publish` workflow is triggered
235
+ - The package is published to npm and GitHub Packages
236
+ - Storybook documentation is automatically updated
237
+
238
+ The storybook hosted on GitHub pages will be automatically updated on each push to `main`. If there's a problem, try running the action manually from the [Actions settings](https://github.com/Doist/reactist/actions).
@@ -1905,7 +1905,9 @@ function PasswordHiddenIcon(props) {
1905
1905
 
1906
1906
  var modules_540a88ff = {"container":"d5ff04da","auxiliaryLabel":"_8d2b52f1","bordered":"_49c37b27","error":"_922ff337","primaryLabel":"af23c791","loadingIcon":"_75edcef6"};
1907
1907
 
1908
- const MAX_LENGTH_THRESHOLD = 10;
1908
+ // See: https://twist.com/a/1585/ch/765851/t/6664583/c/93631846 for latest spec
1909
+
1910
+ const MAX_LENGTH_THRESHOLD = 0;
1909
1911
 
1910
1912
  function fieldToneToTextTone(tone) {
1911
1913
  return tone === 'error' ? 'danger' : tone === 'success' ? 'positive' : 'secondary';
@@ -1959,6 +1961,10 @@ function validateInputLength({
1959
1961
  tone: isNearMaxLength ? 'error' : 'neutral'
1960
1962
  };
1961
1963
  }
1964
+ /**
1965
+ * BaseField is a base component that provides a consistent structure for form fields.
1966
+ */
1967
+
1962
1968
 
1963
1969
  function BaseField({
1964
1970
  variant = 'default',
@@ -1973,7 +1979,8 @@ function BaseField({
1973
1979
  maxLength,
1974
1980
  hidden,
1975
1981
  'aria-describedby': originalAriaDescribedBy,
1976
- id: originalId
1982
+ id: originalId,
1983
+ characterCountPosition = 'below'
1977
1984
  }) {
1978
1985
  const id = useId(originalId);
1979
1986
  const messageId = useId();
@@ -1984,6 +1991,16 @@ function BaseField({
1984
1991
  const [characterCount, setCharacterCount] = React__namespace.useState(inputLength.count);
1985
1992
  const [characterCountTone, setCharacterCountTone] = React__namespace.useState(inputLength.tone);
1986
1993
  const ariaDescribedBy = originalAriaDescribedBy != null ? originalAriaDescribedBy : message ? messageId : null;
1994
+ /**
1995
+ * Renders the character count element.
1996
+ * If the characterCountPosition value is 'hidden', it returns null.
1997
+ */
1998
+
1999
+ function renderCharacterCount() {
2000
+ return characterCountPosition !== 'hidden' ? /*#__PURE__*/React__namespace.createElement(FieldCharacterCount, {
2001
+ tone: characterCountTone
2002
+ }, characterCount) : null;
2003
+ }
1987
2004
 
1988
2005
  const childrenProps = _objectSpread2(_objectSpread2({
1989
2006
  id,
@@ -2004,8 +2021,10 @@ function BaseField({
2004
2021
  });
2005
2022
  setCharacterCount(inputLength.count);
2006
2023
  setCharacterCountTone(inputLength.tone);
2007
- }
2024
+ },
2008
2025
 
2026
+ // If the character count is inline, we pass it as a prop to the children element so it can be rendered inline
2027
+ characterCountElement: characterCountPosition === 'inline' ? renderCharacterCount() : null
2009
2028
  });
2010
2029
 
2011
2030
  React__namespace.useEffect(function updateCharacterCountOnPropChange() {
@@ -2049,17 +2068,15 @@ function BaseField({
2049
2068
  }, /*#__PURE__*/React__namespace.createElement(FieldMessage, {
2050
2069
  id: messageId,
2051
2070
  tone: tone
2052
- }, message)) : null, characterCount ? /*#__PURE__*/React__namespace.createElement(Column, {
2071
+ }, message)) : null, characterCountPosition === 'below' ? /*#__PURE__*/React__namespace.createElement(Column, {
2053
2072
  width: "content"
2054
- }, /*#__PURE__*/React__namespace.createElement(FieldCharacterCount, {
2055
- tone: characterCountTone
2056
- }, characterCount)) : null) : null);
2073
+ }, renderCharacterCount()) : null) : null);
2057
2074
  }
2058
2075
 
2059
- var modules_aaf25250 = {"inputWrapper":"f2de4e8d","readOnly":"ee26e40c","bordered":"_3afb1a56","error":"f3ff9f57","slot":"_3eb7b0ef"};
2076
+ var modules_aaf25250 = {"inputWrapper":"c8f65b3b","readOnly":"_326f2644","bordered":"_5252fd3d","error":"_0141b7ac","slot":"b79b851f"};
2060
2077
 
2061
- const _excluded$d = ["variant", "id", "label", "value", "auxiliaryLabel", "message", "tone", "type", "maxWidth", "maxLength", "hidden", "aria-describedby", "startSlot", "endSlot", "onChange"],
2062
- _excluded2$4 = ["onChange"];
2078
+ const _excluded$d = ["variant", "id", "label", "value", "auxiliaryLabel", "message", "tone", "type", "maxWidth", "maxLength", "hidden", "aria-describedby", "startSlot", "endSlot", "onChange", "characterCountPosition"],
2079
+ _excluded2$4 = ["onChange", "characterCountElement"];
2063
2080
  const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_ref, ref) {
2064
2081
  let {
2065
2082
  variant = 'default',
@@ -2076,7 +2093,8 @@ const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_r
2076
2093
  'aria-describedby': ariaDescribedBy,
2077
2094
  startSlot,
2078
2095
  endSlot,
2079
- onChange: originalOnChange
2096
+ onChange: originalOnChange,
2097
+ characterCountPosition = 'below'
2080
2098
  } = _ref,
2081
2099
  props = _objectWithoutProperties(_ref, _excluded$d);
2082
2100
 
@@ -2101,10 +2119,12 @@ const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_r
2101
2119
  maxWidth: maxWidth,
2102
2120
  maxLength: maxLength,
2103
2121
  hidden: hidden,
2104
- "aria-describedby": ariaDescribedBy
2122
+ "aria-describedby": ariaDescribedBy,
2123
+ characterCountPosition: characterCountPosition
2105
2124
  }, _ref2 => {
2106
2125
  let {
2107
- onChange
2126
+ onChange,
2127
+ characterCountElement
2108
2128
  } = _ref2,
2109
2129
  extraProps = _objectWithoutProperties(_ref2, _excluded2$4);
2110
2130
 
@@ -2126,12 +2146,12 @@ const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_r
2126
2146
  originalOnChange == null ? void 0 : originalOnChange(event);
2127
2147
  onChange == null ? void 0 : onChange(event);
2128
2148
  }
2129
- })), endSlot ? /*#__PURE__*/React__namespace.createElement(Box$1, {
2149
+ })), endSlot || characterCountElement ? /*#__PURE__*/React__namespace.createElement(Box$1, {
2130
2150
  className: modules_aaf25250.slot,
2131
2151
  display: "flex",
2132
2152
  marginRight: variant === 'bordered' ? '-xsmall' : 'xsmall',
2133
2153
  marginLeft: variant === 'bordered' ? 'xsmall' : '-xsmall'
2134
- }, endSlot) : null);
2154
+ }, characterCountElement, endSlot) : null);
2135
2155
  });
2136
2156
  });
2137
2157