@atlaskit/form 10.5.7 → 10.5.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/form
2
2
 
3
+ ## 10.5.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#153024](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/153024)
8
+ [`f2ca7201459b1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f2ca7201459b1) -
9
+ Change `react-uid` to use ID generator that is compatible with React16 and React 18; Strict React
10
+ 18 behind a flag.
11
+
3
12
  ## 10.5.7
4
13
 
5
14
  ### Patch Changes
package/dist/cjs/field.js CHANGED
@@ -10,8 +10,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
11
  var _react = require("react");
12
12
  var _react2 = require("@emotion/react");
13
- var _reactUid = require("react-uid");
14
13
  var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
14
+ var _useId = require("@atlaskit/ds-lib/use-id");
15
15
  var _fieldIdContext = require("./field-id-context");
16
16
  var _form = require("./form");
17
17
  var _label = require("./label");
@@ -82,7 +82,7 @@ function Field(props) {
82
82
  * effectively made it an optional prop to external consumers of Field. However the
83
83
  * prop types defined defaultValue as required, so inside the component it was not
84
84
  * valid for defaultValue to be undefined. We need to suppress the error
85
- * after changing defaultValue to explictly be an optional prop.
85
+ * after changing defaultValue to explicitly be an optional prop.
86
86
  * If default value has changed we are using new default value.
87
87
  * Otherwise we need to check if we already have value for this field
88
88
  * (because we are using changing key prop to re-run field level validation, and that
@@ -220,13 +220,10 @@ function Field(props) {
220
220
  });
221
221
  return unregister;
222
222
  }, [latestPropsRef, latestStateRef, registerField, props.name, isDefaultValueChanged]);
223
- var fieldId = (0, _react.useMemo)(
224
- // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
225
- function () {
226
- return props.id ? props.id : "".concat(props.name, "-").concat((0, _reactUid.uid)({
227
- id: props.name
228
- }));
229
- }, [props.id, props.name]);
223
+ var uid = (0, _useId.useId)();
224
+ var fieldId = (0, _react.useMemo)(function () {
225
+ return props.id ? props.id : "".concat(props.name, "-").concat(uid);
226
+ }, [props.id, props.name, uid]);
230
227
  var getDescribedBy = function getDescribedBy() {
231
228
  var value = '';
232
229
  if (state.error) {
@@ -6,8 +6,8 @@ import { useContext, useEffect, useMemo, useRef, useState } from 'react';
6
6
 
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { css, jsx } from '@emotion/react';
9
- import { uid } from 'react-uid';
10
9
  import invariant from 'tiny-invariant';
10
+ import { useId } from '@atlaskit/ds-lib/use-id';
11
11
  import { FieldId } from './field-id-context';
12
12
  import { FormContext, IsDisabledContext } from './form';
13
13
  import { Label } from './label';
@@ -74,7 +74,7 @@ export default function Field(props) {
74
74
  * effectively made it an optional prop to external consumers of Field. However the
75
75
  * prop types defined defaultValue as required, so inside the component it was not
76
76
  * valid for defaultValue to be undefined. We need to suppress the error
77
- * after changing defaultValue to explictly be an optional prop.
77
+ * after changing defaultValue to explicitly be an optional prop.
78
78
  * If default value has changed we are using new default value.
79
79
  * Otherwise we need to check if we already have value for this field
80
80
  * (because we are using changing key prop to re-run field level validation, and that
@@ -208,11 +208,10 @@ export default function Field(props) {
208
208
  });
209
209
  return unregister;
210
210
  }, [latestPropsRef, latestStateRef, registerField, props.name, isDefaultValueChanged]);
211
- const fieldId = useMemo(
212
- // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
213
- () => props.id ? props.id : `${props.name}-${uid({
214
- id: props.name
215
- })}`, [props.id, props.name]);
211
+ const uid = useId();
212
+ const fieldId = useMemo(() => {
213
+ return props.id ? props.id : `${props.name}-${uid}`;
214
+ }, [props.id, props.name, uid]);
216
215
  const getDescribedBy = () => {
217
216
  let value = '';
218
217
  if (state.error) {
package/dist/esm/field.js CHANGED
@@ -11,8 +11,8 @@ import { useContext, useEffect, useMemo, useRef, useState } from 'react';
11
11
 
12
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
13
13
  import { css, jsx } from '@emotion/react';
14
- import { uid } from 'react-uid';
15
14
  import invariant from 'tiny-invariant';
15
+ import { useId } from '@atlaskit/ds-lib/use-id';
16
16
  import { FieldId } from './field-id-context';
17
17
  import { FormContext, IsDisabledContext } from './form';
18
18
  import { Label } from './label';
@@ -78,7 +78,7 @@ export default function Field(props) {
78
78
  * effectively made it an optional prop to external consumers of Field. However the
79
79
  * prop types defined defaultValue as required, so inside the component it was not
80
80
  * valid for defaultValue to be undefined. We need to suppress the error
81
- * after changing defaultValue to explictly be an optional prop.
81
+ * after changing defaultValue to explicitly be an optional prop.
82
82
  * If default value has changed we are using new default value.
83
83
  * Otherwise we need to check if we already have value for this field
84
84
  * (because we are using changing key prop to re-run field level validation, and that
@@ -216,13 +216,10 @@ export default function Field(props) {
216
216
  });
217
217
  return unregister;
218
218
  }, [latestPropsRef, latestStateRef, registerField, props.name, isDefaultValueChanged]);
219
- var fieldId = useMemo(
220
- // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
221
- function () {
222
- return props.id ? props.id : "".concat(props.name, "-").concat(uid({
223
- id: props.name
224
- }));
225
- }, [props.id, props.name]);
219
+ var uid = useId();
220
+ var fieldId = useMemo(function () {
221
+ return props.id ? props.id : "".concat(props.name, "-").concat(uid);
222
+ }, [props.id, props.name, uid]);
226
223
  var getDescribedBy = function getDescribedBy() {
227
224
  var value = '';
228
225
  if (state.error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "10.5.7",
3
+ "version": "10.5.8",
4
4
  "description": "A form allows users to input information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -24,6 +24,7 @@
24
24
  "runReact18": true
25
25
  },
26
26
  "dependencies": {
27
+ "@atlaskit/ds-lib": "^3.0.0",
27
28
  "@atlaskit/heading": "^2.4.0",
28
29
  "@atlaskit/icon": "^22.22.0",
29
30
  "@atlaskit/primitives": "^12.2.0",
@@ -34,7 +35,6 @@
34
35
  "final-form": "^4.20.3",
35
36
  "final-form-focus": "^1.1.2",
36
37
  "lodash": "^4.17.21",
37
- "react-uid": "^2.2.0",
38
38
  "tiny-invariant": "^1.2.0"
39
39
  },
40
40
  "peerDependencies": {
@@ -47,7 +47,6 @@
47
47
  "@atlaskit/banner": "^12.5.0",
48
48
  "@atlaskit/button": "^20.2.0",
49
49
  "@atlaskit/checkbox": "^14.0.0",
50
- "@atlaskit/ds-lib": "^3.1.0",
51
50
  "@atlaskit/modal-dialog": "^12.17.0",
52
51
  "@atlaskit/radio": "^6.5.0",
53
52
  "@atlaskit/range": "^7.4.0",