strapi-plugin-tags-custom-field 1.0.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.
@@ -0,0 +1,221 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
3
+ const v = glob[path];
4
+ if (v) {
5
+ return typeof v === "function" ? v() : Promise.resolve(v);
6
+ }
7
+ return new Promise((_, reject) => {
8
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
9
+ reject.bind(
10
+ null,
11
+ new Error(
12
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
13
+ )
14
+ )
15
+ );
16
+ });
17
+ };
18
+ const PLUGIN_ID = "tags-input";
19
+ const PluginIcon = () => /* @__PURE__ */ jsxs(
20
+ "svg",
21
+ {
22
+ width: "16",
23
+ height: "16",
24
+ viewBox: "0 0 24 24",
25
+ fill: "none",
26
+ xmlns: "http://www.w3.org/2000/svg",
27
+ "aria-hidden": "true",
28
+ focusable: "false",
29
+ children: [
30
+ /* @__PURE__ */ jsx(
31
+ "path",
32
+ {
33
+ d: "M7 8h10M7 12h7M7 16h10",
34
+ stroke: "currentColor",
35
+ strokeWidth: "2",
36
+ strokeLinecap: "round"
37
+ }
38
+ ),
39
+ /* @__PURE__ */ jsx(
40
+ "path",
41
+ {
42
+ d: "M4 5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5Z",
43
+ stroke: "currentColor",
44
+ strokeWidth: "2"
45
+ }
46
+ )
47
+ ]
48
+ }
49
+ );
50
+ const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
51
+ const index = {
52
+ register(app) {
53
+ app.customFields.register({
54
+ name: "tags",
55
+ pluginId: PLUGIN_ID,
56
+ type: "json",
57
+ intlLabel: {
58
+ id: getTranslation("field.tags.label"),
59
+ defaultMessage: "Tags"
60
+ },
61
+ intlDescription: {
62
+ id: getTranslation("field.tags.description"),
63
+ defaultMessage: "Edit tags as an array of strings"
64
+ },
65
+ icon: PluginIcon,
66
+ components: {
67
+ Input: async () => import("./TagsInput-CCehyU5Y.mjs").then((module) => ({
68
+ default: module.TagsInput
69
+ }))
70
+ },
71
+ options: {
72
+ base: [
73
+ {
74
+ sectionTitle: {
75
+ id: getTranslation("field.tags.options.behavior.section"),
76
+ defaultMessage: "Tag behavior"
77
+ },
78
+ items: [
79
+ {
80
+ intlLabel: {
81
+ id: getTranslation("field.tags.options.maxTags.label"),
82
+ defaultMessage: "Maximum tags"
83
+ },
84
+ description: {
85
+ id: getTranslation("field.tags.options.maxTags.description"),
86
+ defaultMessage: "Maximum number of tags allowed"
87
+ },
88
+ name: "options.maxTags",
89
+ type: "number",
90
+ value: 20
91
+ },
92
+ {
93
+ intlLabel: {
94
+ id: getTranslation("field.tags.options.maxTagLength.label"),
95
+ defaultMessage: "Maximum tag length"
96
+ },
97
+ description: {
98
+ id: getTranslation(
99
+ "field.tags.options.maxTagLength.description"
100
+ ),
101
+ defaultMessage: "Maximum number of characters per tag"
102
+ },
103
+ name: "options.maxTagLength",
104
+ type: "number",
105
+ value: 40
106
+ },
107
+ {
108
+ intlLabel: {
109
+ id: getTranslation("field.tags.options.allowDuplicates.label"),
110
+ defaultMessage: "Allow duplicates"
111
+ },
112
+ description: {
113
+ id: getTranslation(
114
+ "field.tags.options.allowDuplicates.description"
115
+ ),
116
+ defaultMessage: "Allow repeated tags in the same value"
117
+ },
118
+ name: "options.allowDuplicates",
119
+ type: "checkbox",
120
+ value: false
121
+ }
122
+ ]
123
+ },
124
+ {
125
+ sectionTitle: {
126
+ id: getTranslation("field.tags.options.input.section"),
127
+ defaultMessage: "Input parsing"
128
+ },
129
+ items: [
130
+ {
131
+ intlLabel: {
132
+ id: getTranslation("field.tags.options.separator.label"),
133
+ defaultMessage: "Separator"
134
+ },
135
+ description: {
136
+ id: getTranslation("field.tags.options.separator.description"),
137
+ defaultMessage: "Character used to split typed and pasted values"
138
+ },
139
+ name: "options.separator",
140
+ type: "text",
141
+ value: ","
142
+ },
143
+ {
144
+ intlLabel: {
145
+ id: getTranslation("field.tags.options.normalizeCase.label"),
146
+ defaultMessage: "Normalize case"
147
+ },
148
+ description: {
149
+ id: getTranslation(
150
+ "field.tags.options.normalizeCase.description"
151
+ ),
152
+ defaultMessage: "Transform tag casing before saving"
153
+ },
154
+ name: "options.normalizeCase",
155
+ type: "select",
156
+ value: "none",
157
+ options: [
158
+ {
159
+ key: "none",
160
+ value: "none",
161
+ metadatas: {
162
+ intlLabel: {
163
+ id: getTranslation(
164
+ "field.tags.options.normalizeCase.none"
165
+ ),
166
+ defaultMessage: "None"
167
+ }
168
+ }
169
+ },
170
+ {
171
+ key: "lowercase",
172
+ value: "lowercase",
173
+ metadatas: {
174
+ intlLabel: {
175
+ id: getTranslation(
176
+ "field.tags.options.normalizeCase.lowercase"
177
+ ),
178
+ defaultMessage: "lowercase"
179
+ }
180
+ }
181
+ },
182
+ {
183
+ key: "uppercase",
184
+ value: "uppercase",
185
+ metadatas: {
186
+ intlLabel: {
187
+ id: getTranslation(
188
+ "field.tags.options.normalizeCase.uppercase"
189
+ ),
190
+ defaultMessage: "UPPERCASE"
191
+ }
192
+ }
193
+ }
194
+ ]
195
+ }
196
+ ]
197
+ }
198
+ ]
199
+ }
200
+ });
201
+ app.registerPlugin({
202
+ id: PLUGIN_ID,
203
+ name: "Tags Input"
204
+ });
205
+ },
206
+ async registerTrads({ locales }) {
207
+ return Promise.all(
208
+ locales.map(async (locale) => {
209
+ try {
210
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-BhiXf-Vq.mjs") }), `./translations/${locale}.json`, 3);
211
+ return { data, locale };
212
+ } catch {
213
+ return { data: {}, locale };
214
+ }
215
+ })
216
+ );
217
+ }
218
+ };
219
+ export {
220
+ index as default
221
+ };
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ register(app: any): void;
3
+ registerTrads({ locales }: {
4
+ locales: string[];
5
+ }): Promise<{
6
+ data: any;
7
+ locale: string;
8
+ }[]>;
9
+ };
10
+ export default _default;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const bootstrap = ({ strapi }) => {
4
+ };
5
+ const destroy = ({ strapi }) => {
6
+ };
7
+ const register = ({ strapi }) => {
8
+ strapi.customFields.register({
9
+ name: "tags",
10
+ plugin: "tags-input",
11
+ type: "json",
12
+ inputSize: {
13
+ default: 12,
14
+ isResizable: true
15
+ }
16
+ });
17
+ };
18
+ const config = {
19
+ default: {},
20
+ validator() {
21
+ }
22
+ };
23
+ const contentTypes = {};
24
+ const middlewares = {};
25
+ const policies = {};
26
+ const index = {
27
+ register,
28
+ bootstrap,
29
+ destroy,
30
+ config,
31
+ controllers: {},
32
+ routes: {},
33
+ services: {},
34
+ contentTypes,
35
+ policies,
36
+ middlewares
37
+ };
38
+ exports.default = index;
@@ -0,0 +1,38 @@
1
+ const bootstrap = ({ strapi }) => {
2
+ };
3
+ const destroy = ({ strapi }) => {
4
+ };
5
+ const register = ({ strapi }) => {
6
+ strapi.customFields.register({
7
+ name: "tags",
8
+ plugin: "tags-input",
9
+ type: "json",
10
+ inputSize: {
11
+ default: 12,
12
+ isResizable: true
13
+ }
14
+ });
15
+ };
16
+ const config = {
17
+ default: {},
18
+ validator() {
19
+ }
20
+ };
21
+ const contentTypes = {};
22
+ const middlewares = {};
23
+ const policies = {};
24
+ const index = {
25
+ register,
26
+ bootstrap,
27
+ destroy,
28
+ config,
29
+ controllers: {},
30
+ routes: {},
31
+ services: {},
32
+ contentTypes,
33
+ policies,
34
+ middlewares
35
+ };
36
+ export {
37
+ index as default
38
+ };
@@ -0,0 +1,22 @@
1
+ declare const _default: {
2
+ register: ({ strapi }: {
3
+ strapi: import('@strapi/types/dist/core').Strapi;
4
+ }) => void;
5
+ bootstrap: ({ strapi }: {
6
+ strapi: import('@strapi/types/dist/core').Strapi;
7
+ }) => void;
8
+ destroy: ({ strapi }: {
9
+ strapi: import('@strapi/types/dist/core').Strapi;
10
+ }) => void;
11
+ config: {
12
+ default: {};
13
+ validator(): void;
14
+ };
15
+ controllers: {};
16
+ routes: {};
17
+ services: {};
18
+ contentTypes: {};
19
+ policies: {};
20
+ middlewares: {};
21
+ };
22
+ export default _default;
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "strapi-plugin-tags-custom-field",
3
+ "version": "1.0.0",
4
+ "description": "Custom field plugin for Strapi 5 to manage tags (array of strings) stored as JSON array.",
5
+ "keywords": [
6
+ "strapi",
7
+ "strapi-plugin",
8
+ "strapi5",
9
+ "custom-field",
10
+ "tags"
11
+ ],
12
+ "type": "commonjs",
13
+ "exports": {
14
+ "./package.json": "./package.json",
15
+ "./strapi-admin": {
16
+ "types": "./dist/admin/src/index.d.ts",
17
+ "source": "./admin/src/index.ts",
18
+ "import": "./dist/admin/index.mjs",
19
+ "require": "./dist/admin/index.js",
20
+ "default": "./dist/admin/index.js"
21
+ },
22
+ "./strapi-server": {
23
+ "types": "./dist/server/src/index.d.ts",
24
+ "source": "./server/src/index.ts",
25
+ "import": "./dist/server/index.mjs",
26
+ "require": "./dist/server/index.js",
27
+ "default": "./dist/server/index.js"
28
+ }
29
+ },
30
+ "files": ["dist"],
31
+ "scripts": {
32
+ "build": "strapi-plugin build",
33
+ "watch": "strapi-plugin watch",
34
+ "watch:link": "strapi-plugin watch:link",
35
+ "verify": "strapi-plugin verify",
36
+ "test:ts:front": "tsc -p admin/tsconfig.json --noEmit",
37
+ "test:ts:back": "tsc -p server/tsconfig.json --noEmit",
38
+ "test:ts": "npm run test:ts:front && npm run test:ts:back",
39
+ "release:check": "npm run test:ts && npm run build && npm run verify",
40
+ "prepublishOnly": "npm run release:check"
41
+ },
42
+ "dependencies": {},
43
+ "devDependencies": {
44
+ "@strapi/strapi": "^5.39.0",
45
+ "@strapi/sdk-plugin": "^6.0.1",
46
+ "prettier": "^3.8.1",
47
+ "@strapi/design-system": "^2.0.0-rc.30",
48
+ "@strapi/icons": "^2.0.0-rc.30",
49
+ "react-intl": "^6.8.9",
50
+ "react": "^18.3.1",
51
+ "react-dom": "^18.3.1",
52
+ "react-router-dom": "^6.30.3",
53
+ "styled-components": "^6.3.11",
54
+ "@types/react": "^19.2.14",
55
+ "@types/react-dom": "^19.2.3",
56
+ "@strapi/typescript-utils": "^5.39.0",
57
+ "typescript": "^5.9.3"
58
+ },
59
+ "peerDependencies": {
60
+ "@strapi/strapi": "^5.39.0",
61
+ "@strapi/sdk-plugin": "^6.0.1",
62
+ "@strapi/design-system": "^2.0.0-rc.30",
63
+ "@strapi/icons": "^2.0.0-rc.30",
64
+ "react-intl": "^6.8.9",
65
+ "react": "^18.3.1",
66
+ "react-dom": "^18.3.1",
67
+ "react-router-dom": "^6.30.3",
68
+ "styled-components": "^6.3.11"
69
+ },
70
+ "strapi": {
71
+ "kind": "plugin",
72
+ "name": "tags-input",
73
+ "displayName": "Tags Input",
74
+ "description": "Custom field for tags (array of strings) stored as JSON array"
75
+ },
76
+ "engines": {
77
+ "node": ">=18.0.0"
78
+ },
79
+ "repository": {
80
+ "type": "git",
81
+ "url": "https://github.com/ronysfreitas/strapi-plugin-tags-input.git"
82
+ },
83
+ "homepage": "https://github.com/ronysfreitas/strapi-plugin-tags-input#readme",
84
+ "bugs": {
85
+ "url": "https://github.com/ronysfreitas/strapi-plugin-tags-input/issues"
86
+ },
87
+ "license": "MIT",
88
+ "author": "Rony Freitas <ronyfreitas98@gmail.com>"
89
+ }