sanity-plugin-internationalized-array 2.0.1-canary.0 → 2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity-plugin-internationalized-array",
3
- "version": "2.0.1-canary.0",
3
+ "version": "2.1.0",
4
4
  "description": "Store localized fields in an array to save on attributes",
5
5
  "keywords": [
6
6
  "sanity",
@@ -28,6 +28,7 @@
28
28
  },
29
29
  "main": "./lib/index.js",
30
30
  "module": "./lib/index.esm.js",
31
+ "source": "./src/index.ts",
31
32
  "types": "./lib/index.d.ts",
32
33
  "files": [
33
34
  "lib",
@@ -35,11 +36,23 @@
35
36
  "src",
36
37
  "v2-incompatible.js"
37
38
  ],
39
+ "scripts": {
40
+ "prebuild": "npm run clean",
41
+ "build": "pkg build --strict && pkg check --strict",
42
+ "clean": "rimraf lib",
43
+ "format": "prettier --write --cache --ignore-unknown .",
44
+ "link-watch": "plugin-kit link-watch",
45
+ "lint": "eslint .",
46
+ "lint:fix": "eslint . --fix",
47
+ "prepare": "husky install",
48
+ "prepublishOnly": "run-s build",
49
+ "watch": "pkg-utils watch --strict"
50
+ },
38
51
  "dependencies": {
39
- "@sanity/icons": "^3.3.1",
52
+ "@sanity/icons": "^2.11.7",
40
53
  "@sanity/incompatible-plugin": "^1.0.4",
41
54
  "@sanity/language-filter": "^4.0.2",
42
- "@sanity/ui": "^2.8.8",
55
+ "@sanity/ui": "^2.1.0",
43
56
  "fast-deep-equal": "^3.1.3",
44
57
  "lodash": "^4.17.21",
45
58
  "suspend-react": "0.1.3"
@@ -47,8 +60,8 @@
47
60
  "devDependencies": {
48
61
  "@commitlint/cli": "^19.2.1",
49
62
  "@commitlint/config-conventional": "^19.1.0",
50
- "@sanity/pkg-utils": "^6.10.9",
51
- "@sanity/plugin-kit": "^4.0.18",
63
+ "@sanity/pkg-utils": "^6.1.0",
64
+ "@sanity/plugin-kit": "^3.1.10",
52
65
  "@sanity/semantic-release-preset": "^4.1.7",
53
66
  "@types/lodash": "^4.17.0",
54
67
  "@types/react": "^18.2.75",
@@ -66,12 +79,13 @@
66
79
  "npm-run-all2": "^5.0.0",
67
80
  "prettier": "^3.2.5",
68
81
  "prettier-plugin-packagejson": "^2.4.14",
69
- "react": "^18.3.1",
70
- "react-dom": "^18.3.1",
71
- "react-is": "^18.3.1",
82
+ "react": "^18.2.0",
83
+ "react-dom": "^18.2.0",
84
+ "react-is": "^18.2.0",
85
+ "rimraf": "^4.4.1",
72
86
  "sanity": "^3.36.4",
73
87
  "semantic-release": "^23.0.7",
74
- "typescript": "5.5.4"
88
+ "typescript": "^5.4.4"
75
89
  },
76
90
  "peerDependencies": {
77
91
  "@sanity/ui": "^2.1.0",
@@ -88,13 +102,5 @@
88
102
  "eslintImports": false,
89
103
  "dependencies": false
90
104
  }
91
- },
92
- "scripts": {
93
- "build": "pkg build --strict --check --clean",
94
- "format": "prettier --write --cache --ignore-unknown .",
95
- "link-watch": "plugin-kit link-watch",
96
- "lint": "eslint .",
97
- "lint:fix": "eslint . --fix",
98
- "watch": "pkg-utils watch --strict"
99
105
  }
100
- }
106
+ }
@@ -46,9 +46,7 @@ export function InternationalizedArrayProvider(
46
46
 
47
47
  const client = useClient({apiVersion: internationalizedArray.apiVersion})
48
48
  const workspace = useWorkspace()
49
- // @ts-expect-error - TODO fix
50
49
  const {value: document} = useFormBuilder()
51
- console.log({document}, useFormBuilder())
52
50
  const deferredDocument = useDeferredValue(document)
53
51
  const selectedValue = useMemo(
54
52
  () => getSelectedValue(internationalizedArray.select, deferredDocument),
@@ -89,7 +87,7 @@ export function InternationalizedArrayProvider(
89
87
 
90
88
  const showDocumentButtons =
91
89
  internationalizedArray.buttonLocations.includes('document')
92
- console.log({showDocumentButtons})
90
+
93
91
  return (
94
92
  <InternationalizedArrayContext.Provider
95
93
  value={{
@@ -35,12 +35,7 @@ export default (config: ArrayFactoryConfig): FieldDefinition<'array'> => {
35
35
  input: InternationalizedArray,
36
36
  },
37
37
  // These options are required for validation rules – not the custom input component
38
- options: {
39
- // @ts-expect-error - find out why it fails
40
- apiVersion,
41
- select,
42
- languages,
43
- },
38
+ options: {apiVersion, select, languages},
44
39
  of: [
45
40
  defineField({
46
41
  ...(typeof type === 'string' ? {} : type),
@@ -48,7 +43,6 @@ export default (config: ArrayFactoryConfig): FieldDefinition<'array'> => {
48
43
  type: objectName,
49
44
  }),
50
45
  ],
51
- // @ts-expect-error - find out why it fails
52
46
  validation: (rule: Rule) =>
53
47
  rule.custom<Value[]>(async (value, context) => {
54
48
  if (!value) {
@@ -18,9 +18,9 @@ export default (config: ObjectFactoryConfig): FieldDefinition<'object'> => {
18
18
  title: `Internationalized array ${type}`,
19
19
  type: 'object',
20
20
  components: {
21
- // @ts-expect-error - find out why it fails
22
21
  item: InternationalizedInput,
23
22
  },
23
+ // @ts-expect-error - Address this typing issue with the inner object
24
24
  fields: [
25
25
  typeof type === `string`
26
26
  ? // Define a simple field if all we have is the name as a string