@tunghtml/strapi-plugin-multiselect-checkbox 1.0.0 → 1.0.1

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.
@@ -4,16 +4,14 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const designSystem = require("@strapi/design-system");
5
5
  const reactIntl = require("react-intl");
6
6
  const styled = require("styled-components");
7
- const index = require("./index-DTMA037h.js");
7
+ const index = require("./index-dXy7p2G8.js");
8
8
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
9
9
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
10
10
  const config = {
11
11
  /**
12
12
  * The default options used as fallbacks in case the user-defined values are missing.
13
13
  */
14
- defaultOptions: {
15
- availableOptions: []
16
- }
14
+ defaultOptions: []
17
15
  };
18
16
  const CapitalizedText = styled__default.default.p`
19
17
  &::first-letter {
@@ -25,7 +23,7 @@ const EmptyState = () => {
25
23
  };
26
24
  const Multiselect = (props) => {
27
25
  const { attribute, disabled, hint, label, name, onChange, required, type, value } = props;
28
- const { availableOptions = config.defaultOptions.availableOptions } = attribute.options;
26
+ const availableOptions = attribute?.options || config.defaultOptions;
29
27
  const selectedOptions = Array.isArray(value) ? value : [];
30
28
  const updateValue = (value2) => onChange({ target: { name, value: value2, type } });
31
29
  const updateSelectedOptions = (option, isSelected) => {
@@ -40,7 +38,6 @@ const Multiselect = (props) => {
40
38
  availableOptions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(EmptyState, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, direction: "column", alignItems: "leading", children: availableOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
41
39
  designSystem.Checkbox,
42
40
  {
43
- option,
44
41
  checked: selectedOptions.includes(option),
45
42
  disabled: disabled ?? false,
46
43
  onCheckedChange: (isSelected) => updateSelectedOptions(option, isSelected),
@@ -0,0 +1,159 @@
1
+ import { useRef, useEffect } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Flex } from "@strapi/design-system";
4
+ import { Check } from "@strapi/icons";
5
+ import styled from "styled-components";
6
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
7
+ const v = glob[path];
8
+ if (v) {
9
+ return typeof v === "function" ? v() : Promise.resolve(v);
10
+ }
11
+ return new Promise((_, reject) => {
12
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
13
+ reject.bind(
14
+ null,
15
+ new Error(
16
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
17
+ )
18
+ )
19
+ );
20
+ });
21
+ };
22
+ const PLUGIN_ID = "multiselect-checkbox";
23
+ const Initializer = ({ setPlugin }) => {
24
+ const ref = useRef(setPlugin);
25
+ useEffect(() => {
26
+ ref.current(PLUGIN_ID);
27
+ }, []);
28
+ return null;
29
+ };
30
+ const IconBox = styled(Flex)`
31
+ background-color: #f0f0ff; /* primary100 */
32
+ border: 1px solid #d9d8ff; /* primary200 */
33
+
34
+ svg > path {
35
+ fill: #4945ff; /* primary600 */
36
+ }
37
+ `;
38
+ const PluginIcon = () => {
39
+ return /* @__PURE__ */ jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsx(Check, {}) });
40
+ };
41
+ const prefixKey = (key) => `${PLUGIN_ID}.${key}`;
42
+ const index = {
43
+ register(app) {
44
+ app.customFields.register({
45
+ name: "multiselect-checkbox",
46
+ pluginId: `${PLUGIN_ID}`,
47
+ type: "json",
48
+ icon: PluginIcon,
49
+ intlLabel: {
50
+ id: `${PLUGIN_ID}.label`,
51
+ defaultMessage: "Multiselect Checkbox"
52
+ },
53
+ intlDescription: {
54
+ id: `${PLUGIN_ID}.description`,
55
+ defaultMessage: "Select multiple options using checkboxes. Data stored as JSON array."
56
+ },
57
+ components: {
58
+ Input: async () => import("./index-mocR0IHA.mjs")
59
+ },
60
+ options: {
61
+ base: [
62
+ {
63
+ sectionTitle: null,
64
+ items: [
65
+ {
66
+ name: "options",
67
+ type: "textarea-enum",
68
+ intlLabel: {
69
+ id: prefixKey("options.available-options.label"),
70
+ defaultMessage: "Options (one per line)"
71
+ },
72
+ description: {
73
+ id: prefixKey("options.available-options.description"),
74
+ defaultMessage: "Enter one option per line."
75
+ },
76
+ placeholder: {
77
+ id: prefixKey("options.available-options.placeholder"),
78
+ defaultMessage: "Option 1\nOption 2\nOption 3"
79
+ }
80
+ },
81
+ {
82
+ name: "default",
83
+ type: "json",
84
+ intlLabel: {
85
+ id: prefixKey("options.default.label"),
86
+ defaultMessage: "Default value"
87
+ },
88
+ description: {
89
+ id: prefixKey("options.default.description"),
90
+ defaultMessage: 'Set the default value in JSON format, ex: ["Option 1", "Option 2"]'
91
+ },
92
+ defaultValue: "[]"
93
+ }
94
+ ]
95
+ }
96
+ ],
97
+ //
98
+ // Strapi default advanced options.
99
+ //
100
+ advanced: [
101
+ {
102
+ sectionTitle: {
103
+ id: "global.settings",
104
+ defaultMessage: "Settings"
105
+ },
106
+ items: [
107
+ {
108
+ name: "required",
109
+ type: "checkbox",
110
+ intlLabel: {
111
+ id: "content-type-builder.form.attribute.item.requiredField",
112
+ defaultMessage: "Required field"
113
+ },
114
+ description: {
115
+ id: "content-type-builder.form.attribute.item.requiredField.description",
116
+ defaultMessage: "You won't be able to create an entry if this field is empty"
117
+ }
118
+ },
119
+ {
120
+ name: "private",
121
+ type: "checkbox",
122
+ intlLabel: {
123
+ id: "content-type-builder.form.attribute.item.privateField",
124
+ defaultMessage: "Private field"
125
+ },
126
+ description: {
127
+ id: "content-type-builder.form.attribute.item.privateField.description",
128
+ defaultMessage: "This field will not show up in the API response"
129
+ }
130
+ }
131
+ ]
132
+ }
133
+ ]
134
+ }
135
+ });
136
+ app.registerPlugin({
137
+ id: PLUGIN_ID,
138
+ initializer: Initializer,
139
+ isReady: false,
140
+ name: PLUGIN_ID
141
+ });
142
+ },
143
+ async registerTrads({ locales }) {
144
+ return Promise.all(
145
+ locales.map(async (locale) => {
146
+ try {
147
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-tWwdhLO5.mjs") }), `./translations/${locale}.json`, 3);
148
+ return { data, locale };
149
+ } catch {
150
+ return { data: {}, locale };
151
+ }
152
+ })
153
+ );
154
+ }
155
+ };
156
+ export {
157
+ index as i,
158
+ prefixKey as p
159
+ };
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ const react = require("react");
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const designSystem = require("@strapi/design-system");
5
+ const icons = require("@strapi/icons");
6
+ const styled = require("styled-components");
7
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
8
+ const styled__default = /* @__PURE__ */ _interopDefault(styled);
9
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
10
+ const v = glob[path];
11
+ if (v) {
12
+ return typeof v === "function" ? v() : Promise.resolve(v);
13
+ }
14
+ return new Promise((_, reject) => {
15
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
16
+ reject.bind(
17
+ null,
18
+ new Error(
19
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
20
+ )
21
+ )
22
+ );
23
+ });
24
+ };
25
+ const PLUGIN_ID = "multiselect-checkbox";
26
+ const Initializer = ({ setPlugin }) => {
27
+ const ref = react.useRef(setPlugin);
28
+ react.useEffect(() => {
29
+ ref.current(PLUGIN_ID);
30
+ }, []);
31
+ return null;
32
+ };
33
+ const IconBox = styled__default.default(designSystem.Flex)`
34
+ background-color: #f0f0ff; /* primary100 */
35
+ border: 1px solid #d9d8ff; /* primary200 */
36
+
37
+ svg > path {
38
+ fill: #4945ff; /* primary600 */
39
+ }
40
+ `;
41
+ const PluginIcon = () => {
42
+ return /* @__PURE__ */ jsxRuntime.jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}) });
43
+ };
44
+ const prefixKey = (key) => `${PLUGIN_ID}.${key}`;
45
+ const index = {
46
+ register(app) {
47
+ app.customFields.register({
48
+ name: "multiselect-checkbox",
49
+ pluginId: `${PLUGIN_ID}`,
50
+ type: "json",
51
+ icon: PluginIcon,
52
+ intlLabel: {
53
+ id: `${PLUGIN_ID}.label`,
54
+ defaultMessage: "Multiselect Checkbox"
55
+ },
56
+ intlDescription: {
57
+ id: `${PLUGIN_ID}.description`,
58
+ defaultMessage: "Select multiple options using checkboxes. Data stored as JSON array."
59
+ },
60
+ components: {
61
+ Input: async () => Promise.resolve().then(() => require("./index-BIpQIwH7.js"))
62
+ },
63
+ options: {
64
+ base: [
65
+ {
66
+ sectionTitle: null,
67
+ items: [
68
+ {
69
+ name: "options",
70
+ type: "textarea-enum",
71
+ intlLabel: {
72
+ id: prefixKey("options.available-options.label"),
73
+ defaultMessage: "Options (one per line)"
74
+ },
75
+ description: {
76
+ id: prefixKey("options.available-options.description"),
77
+ defaultMessage: "Enter one option per line."
78
+ },
79
+ placeholder: {
80
+ id: prefixKey("options.available-options.placeholder"),
81
+ defaultMessage: "Option 1\nOption 2\nOption 3"
82
+ }
83
+ },
84
+ {
85
+ name: "default",
86
+ type: "json",
87
+ intlLabel: {
88
+ id: prefixKey("options.default.label"),
89
+ defaultMessage: "Default value"
90
+ },
91
+ description: {
92
+ id: prefixKey("options.default.description"),
93
+ defaultMessage: 'Set the default value in JSON format, ex: ["Option 1", "Option 2"]'
94
+ },
95
+ defaultValue: "[]"
96
+ }
97
+ ]
98
+ }
99
+ ],
100
+ //
101
+ // Strapi default advanced options.
102
+ //
103
+ advanced: [
104
+ {
105
+ sectionTitle: {
106
+ id: "global.settings",
107
+ defaultMessage: "Settings"
108
+ },
109
+ items: [
110
+ {
111
+ name: "required",
112
+ type: "checkbox",
113
+ intlLabel: {
114
+ id: "content-type-builder.form.attribute.item.requiredField",
115
+ defaultMessage: "Required field"
116
+ },
117
+ description: {
118
+ id: "content-type-builder.form.attribute.item.requiredField.description",
119
+ defaultMessage: "You won't be able to create an entry if this field is empty"
120
+ }
121
+ },
122
+ {
123
+ name: "private",
124
+ type: "checkbox",
125
+ intlLabel: {
126
+ id: "content-type-builder.form.attribute.item.privateField",
127
+ defaultMessage: "Private field"
128
+ },
129
+ description: {
130
+ id: "content-type-builder.form.attribute.item.privateField.description",
131
+ defaultMessage: "This field will not show up in the API response"
132
+ }
133
+ }
134
+ ]
135
+ }
136
+ ]
137
+ }
138
+ });
139
+ app.registerPlugin({
140
+ id: PLUGIN_ID,
141
+ initializer: Initializer,
142
+ isReady: false,
143
+ name: PLUGIN_ID
144
+ });
145
+ },
146
+ async registerTrads({ locales }) {
147
+ return Promise.all(
148
+ locales.map(async (locale) => {
149
+ try {
150
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-pkXKBXLR.js")) }), `./translations/${locale}.json`, 3);
151
+ return { data, locale };
152
+ } catch {
153
+ return { data: {}, locale };
154
+ }
155
+ })
156
+ );
157
+ }
158
+ };
159
+ exports.index = index;
160
+ exports.prefixKey = prefixKey;
@@ -2,14 +2,12 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Field, Box, Flex, Checkbox, Typography } from "@strapi/design-system";
3
3
  import { FormattedMessage } from "react-intl";
4
4
  import styled from "styled-components";
5
- import { p as prefixKey } from "./index-CTLgAy6y.mjs";
5
+ import { p as prefixKey } from "./index-Wx6rXcrm.mjs";
6
6
  const config = {
7
7
  /**
8
8
  * The default options used as fallbacks in case the user-defined values are missing.
9
9
  */
10
- defaultOptions: {
11
- availableOptions: []
12
- }
10
+ defaultOptions: []
13
11
  };
14
12
  const CapitalizedText = styled.p`
15
13
  &::first-letter {
@@ -21,7 +19,7 @@ const EmptyState = () => {
21
19
  };
22
20
  const Multiselect = (props) => {
23
21
  const { attribute, disabled, hint, label, name, onChange, required, type, value } = props;
24
- const { availableOptions = config.defaultOptions.availableOptions } = attribute.options;
22
+ const availableOptions = attribute?.options || config.defaultOptions;
25
23
  const selectedOptions = Array.isArray(value) ? value : [];
26
24
  const updateValue = (value2) => onChange({ target: { name, value: value2, type } });
27
25
  const updateSelectedOptions = (option, isSelected) => {
@@ -36,7 +34,6 @@ const Multiselect = (props) => {
36
34
  availableOptions.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {}) : /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(Flex, { gap: 2, direction: "column", alignItems: "leading", children: availableOptions.map((option) => /* @__PURE__ */ jsx(
37
35
  Checkbox,
38
36
  {
39
- option,
40
37
  checked: selectedOptions.includes(option),
41
38
  disabled: disabled ?? false,
42
39
  onCheckedChange: (isSelected) => updateSelectedOptions(option, isSelected),
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-DTMA037h.js");
2
+ const index = require("../_chunks/index-dXy7p2G8.js");
3
3
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-CTLgAy6y.mjs";
1
+ import { i } from "../_chunks/index-Wx6rXcrm.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
@@ -2,9 +2,7 @@ import type { FieldValue, InputProps } from '@strapi/strapi/admin';
2
2
  /** The properties for our `Multiselect` component below. */
3
3
  type Props = InputProps & FieldValue & {
4
4
  attribute: {
5
- options: {
6
- availableOptions: string[] | undefined;
7
- };
5
+ options: string[] | undefined;
8
6
  };
9
7
  };
10
8
  /**
@@ -1,2 +1,2 @@
1
- declare const PluginIcon: () => import("react/jsx-runtime").JSX.Element;
2
- export { PluginIcon };
1
+ import React from 'react';
2
+ export declare const PluginIcon: React.FC;
@@ -19,8 +19,12 @@ const register = ({ strapi }) => {
19
19
  strapi.customFields.register({
20
20
  name: "multiselect-checkbox",
21
21
  plugin: "multiselect-checkbox",
22
- // The data type stored in the database - using json to store array of strings.
23
- type: "json"
22
+ // The data type stored in the database - JSON array
23
+ type: "json",
24
+ inputSize: {
25
+ default: 12,
26
+ isResizable: true
27
+ }
24
28
  });
25
29
  };
26
30
  const contentAPIRoutes = [];
@@ -18,8 +18,12 @@ const register = ({ strapi }) => {
18
18
  strapi.customFields.register({
19
19
  name: "multiselect-checkbox",
20
20
  plugin: "multiselect-checkbox",
21
- // The data type stored in the database - using json to store array of strings.
22
- type: "json"
21
+ // The data type stored in the database - JSON array
22
+ type: "json",
23
+ inputSize: {
24
+ default: 12,
25
+ isResizable: true
26
+ }
23
27
  });
24
28
  };
25
29
  const contentAPIRoutes = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tunghtml/strapi-plugin-multiselect-checkbox",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A Strapi v5 custom field plugin with checkbox UI that stores selected values as an array of strings (JSON type) instead of comma-separated strings.",
5
5
  "keywords": [
6
6
  "strapi",
@@ -1,136 +0,0 @@
1
- import { useRef, useEffect } from "react";
2
- import { jsx } from "react/jsx-runtime";
3
- const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
4
- const v = glob[path];
5
- if (v) {
6
- return typeof v === "function" ? v() : Promise.resolve(v);
7
- }
8
- return new Promise((_, reject) => {
9
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
10
- reject.bind(
11
- null,
12
- new Error(
13
- "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
14
- )
15
- )
16
- );
17
- });
18
- };
19
- const PLUGIN_ID = "multiselect-checkbox";
20
- const Initializer = ({ setPlugin }) => {
21
- const ref = useRef(setPlugin);
22
- useEffect(() => {
23
- ref.current(PLUGIN_ID);
24
- }, []);
25
- return null;
26
- };
27
- const checkmarkNotepad = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20512%20512'%20xml:space='preserve'%3e%3cpath%20style='fill:%23E1C3A0;'%20d='M406.069,512H105.931c-19.501,0-35.31-15.809-35.31-35.31V70.621c0-19.501,15.809-35.31,35.31-35.31%20h300.138c19.501,0,35.31,15.809,35.31,35.31V476.69C441.379,496.191,425.57,512,406.069,512z'/%3e%3cpath%20style='fill:%23EFF2FA;'%20d='M406.069,485.517H105.931c-4.875,0-8.828-3.953-8.828-8.828V70.621c0-4.875,3.953-8.828,8.828-8.828%20h300.138c4.875,0,8.828,3.953,8.828,8.828V476.69C414.897,481.565,410.944,485.517,406.069,485.517z'/%3e%3cpath%20style='fill:%23C7CFE2;'%20d='M308.966,35.31h-26.483v-8.828C282.483,11.857,270.626,0,256,0s-26.483,11.857-26.483,26.483v8.828%20h-26.483c-9.75,0-17.655,7.904-17.655,17.655v17.655h141.241V52.966C326.621,43.214,318.716,35.31,308.966,35.31z%20M256,35.31%20c-4.875,0-8.828-3.953-8.828-8.828s3.953-8.828,8.828-8.828s8.828,3.953,8.828,8.828S260.875,35.31,256,35.31z'/%3e%3cpath%20style='fill:%23AFB9D2;'%20d='M326.621,79.448H185.379c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h141.241c4.875,0,8.828,3.953,8.828,8.828l0,0C335.448,75.496,331.496,79.448,326.621,79.448z'/%3e%3cpath%20style='fill:%2382889D;'%20d='M167.724,203.034c-2.259,0-4.518-0.862-6.241-2.586L135,173.965c-3.448-3.448-3.448-9.035,0-12.483%20c3.448-3.448,9.035-3.448,12.483,0l20.241,20.242l37.897-37.897c3.448-3.448,9.035-3.448,12.483,0c3.448,3.448,3.448,9.035,0,12.483%20l-44.138,44.138C172.242,202.173,169.983,203.034,167.724,203.034z'/%3e%3cg%20style='opacity:0.97;'%3e%3cpath%20style='fill:%23AFB9D2;'%20d='M317.793,167.724h-70.621c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h70.621c4.875,0,8.828,3.953,8.828,8.828l0,0C326.621,163.772,322.668,167.724,317.793,167.724z'/%3e%3c/g%3e%3cg%20style='opacity:0.97;'%3e%3cpath%20style='fill:%23C7CFE2;'%20d='M361.931,203.034H247.172c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h114.759c4.875,0,8.828,3.953,8.828,8.828l0,0C370.759,199.082,366.806,203.034,361.931,203.034z'/%3e%3c/g%3e%3cpath%20style='fill:%2382889D;'%20d='M167.724,414.897c-2.259,0-4.518-0.862-6.241-2.586L135,385.827c-3.448-3.448-3.448-9.035,0-12.483%20c3.448-3.448,9.035-3.448,12.483,0l20.241,20.242l37.897-37.897c3.448-3.448,9.035-3.448,12.483,0c3.448,3.448,3.448,9.035,0,12.483%20l-44.138,44.138C172.242,414.035,169.983,414.897,167.724,414.897z'/%3e%3cg%20style='opacity:0.97;'%3e%3cpath%20style='fill:%23AFB9D2;'%20d='M317.793,379.586h-70.621c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h70.621c4.875,0,8.828,3.953,8.828,8.828l0,0C326.621,375.634,322.668,379.586,317.793,379.586z'/%3e%3c/g%3e%3cg%20style='opacity:0.97;'%3e%3cpath%20style='fill:%23C7CFE2;'%20d='M361.931,414.897H247.172c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h114.759c4.875,0,8.828,3.953,8.828,8.828l0,0C370.759,410.944,366.806,414.897,361.931,414.897z'/%3e%3c/g%3e%3cpath%20style='fill:%2382889D;'%20d='M167.724,308.966c-2.259,0-4.518-0.862-6.241-2.586L135,279.896c-3.448-3.448-3.448-9.035,0-12.483%20c3.448-3.448,9.035-3.448,12.483,0l20.241,20.242l37.897-37.897c3.448-3.448,9.035-3.448,12.483,0c3.448,3.448,3.448,9.035,0,12.483%20l-44.138,44.138C172.242,308.104,169.983,308.966,167.724,308.966z'/%3e%3cg%20style='opacity:0.97;'%3e%3cpath%20style='fill:%23AFB9D2;'%20d='M317.793,273.655h-70.621c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h70.621c4.875,0,8.828,3.953,8.828,8.828l0,0C326.621,269.703,322.668,273.655,317.793,273.655z'/%3e%3c/g%3e%3cg%20style='opacity:0.97;'%3e%3cpath%20style='fill:%23C7CFE2;'%20d='M361.931,308.966H247.172c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h114.759c4.875,0,8.828,3.953,8.828,8.828l0,0C370.759,305.013,366.806,308.966,361.931,308.966z'/%3e%3c/g%3e%3c/svg%3e";
28
- const PluginIcon = () => /* @__PURE__ */ jsx("img", { src: checkmarkNotepad });
29
- const prefixKey = (key) => `${PLUGIN_ID}.${key}`;
30
- const index = {
31
- register(app) {
32
- app.customFields.register({
33
- name: "multiselect-checkbox",
34
- pluginId: `${PLUGIN_ID}`,
35
- type: "json",
36
- intlLabel: {
37
- id: `${PLUGIN_ID}.label`,
38
- defaultMessage: "Multiselect"
39
- },
40
- intlDescription: {
41
- id: `${PLUGIN_ID}.description`,
42
- defaultMessage: "A custom field for Strapi that allows users to select multiple options from a predefined list."
43
- },
44
- icon: PluginIcon,
45
- components: {
46
- Input: async () => import("./index-tpMZnVWK.mjs")
47
- },
48
- options: {
49
- base: [
50
- {
51
- sectionTitle: null,
52
- items: [
53
- {
54
- name: "options.availableOptions",
55
- type: "textarea-enum",
56
- intlLabel: {
57
- id: prefixKey("options.available-options.label"),
58
- defaultMessage: "Available Options"
59
- },
60
- description: {
61
- id: prefixKey("options.available-options.description"),
62
- defaultMessage: "One option per line."
63
- },
64
- placeholder: {
65
- id: prefixKey("options.available-options.placeholder"),
66
- defaultMessage: "Option 1\nOption 2\nOption 3"
67
- }
68
- }
69
- ]
70
- }
71
- ],
72
- //
73
- // Strapi default advanced options.
74
- //
75
- // - See also: https://github.com/strapi/strapi/blob/develop/packages/core/content-type-builder/admin/src/components/FormModal/attributes/attributeOptions.ts
76
- //
77
- advanced: [
78
- {
79
- sectionTitle: {
80
- id: "global.settings",
81
- defaultMessage: "Settings"
82
- },
83
- items: [
84
- {
85
- name: "required",
86
- type: "checkbox",
87
- intlLabel: {
88
- id: "content-type-builder.form.attribute.item.requiredField",
89
- defaultMessage: "Required field"
90
- },
91
- description: {
92
- id: "content-type-builder.form.attribute.item.requiredField.description",
93
- defaultMessage: "You won't be able to create an entry if this field is empty"
94
- }
95
- },
96
- {
97
- name: "private",
98
- type: "checkbox",
99
- intlLabel: {
100
- id: "content-type-builder.form.attribute.item.privateField",
101
- defaultMessage: "Private field"
102
- },
103
- description: {
104
- id: "content-type-builder.form.attribute.item.privateField.description",
105
- defaultMessage: "This field will not show up in the API response"
106
- }
107
- }
108
- ]
109
- }
110
- ]
111
- }
112
- });
113
- app.registerPlugin({
114
- id: PLUGIN_ID,
115
- initializer: Initializer,
116
- isReady: false,
117
- name: PLUGIN_ID
118
- });
119
- },
120
- async registerTrads({ locales }) {
121
- return Promise.all(
122
- locales.map(async (locale) => {
123
- try {
124
- const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-tWwdhLO5.mjs") }), `./translations/${locale}.json`, 3);
125
- return { data, locale };
126
- } catch {
127
- return { data: {}, locale };
128
- }
129
- })
130
- );
131
- }
132
- };
133
- export {
134
- index as i,
135
- prefixKey as p
136
- };
@@ -1,135 +0,0 @@
1
- "use strict";
2
- const react = require("react");
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
5
- const v = glob[path];
6
- if (v) {
7
- return typeof v === "function" ? v() : Promise.resolve(v);
8
- }
9
- return new Promise((_, reject) => {
10
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
11
- reject.bind(
12
- null,
13
- new Error(
14
- "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
15
- )
16
- )
17
- );
18
- });
19
- };
20
- const PLUGIN_ID = "multiselect-checkbox";
21
- const Initializer = ({ setPlugin }) => {
22
- const ref = react.useRef(setPlugin);
23
- react.useEffect(() => {
24
- ref.current(PLUGIN_ID);
25
- }, []);
26
- return null;
27
- };
28
- const checkmarkNotepad = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20512%20512'%20xml:space='preserve'%3e%3cpath%20style='fill:%23E1C3A0;'%20d='M406.069,512H105.931c-19.501,0-35.31-15.809-35.31-35.31V70.621c0-19.501,15.809-35.31,35.31-35.31%20h300.138c19.501,0,35.31,15.809,35.31,35.31V476.69C441.379,496.191,425.57,512,406.069,512z'/%3e%3cpath%20style='fill:%23EFF2FA;'%20d='M406.069,485.517H105.931c-4.875,0-8.828-3.953-8.828-8.828V70.621c0-4.875,3.953-8.828,8.828-8.828%20h300.138c4.875,0,8.828,3.953,8.828,8.828V476.69C414.897,481.565,410.944,485.517,406.069,485.517z'/%3e%3cpath%20style='fill:%23C7CFE2;'%20d='M308.966,35.31h-26.483v-8.828C282.483,11.857,270.626,0,256,0s-26.483,11.857-26.483,26.483v8.828%20h-26.483c-9.75,0-17.655,7.904-17.655,17.655v17.655h141.241V52.966C326.621,43.214,318.716,35.31,308.966,35.31z%20M256,35.31%20c-4.875,0-8.828-3.953-8.828-8.828s3.953-8.828,8.828-8.828s8.828,3.953,8.828,8.828S260.875,35.31,256,35.31z'/%3e%3cpath%20style='fill:%23AFB9D2;'%20d='M326.621,79.448H185.379c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h141.241c4.875,0,8.828,3.953,8.828,8.828l0,0C335.448,75.496,331.496,79.448,326.621,79.448z'/%3e%3cpath%20style='fill:%2382889D;'%20d='M167.724,203.034c-2.259,0-4.518-0.862-6.241-2.586L135,173.965c-3.448-3.448-3.448-9.035,0-12.483%20c3.448-3.448,9.035-3.448,12.483,0l20.241,20.242l37.897-37.897c3.448-3.448,9.035-3.448,12.483,0c3.448,3.448,3.448,9.035,0,12.483%20l-44.138,44.138C172.242,202.173,169.983,203.034,167.724,203.034z'/%3e%3cg%20style='opacity:0.97;'%3e%3cpath%20style='fill:%23AFB9D2;'%20d='M317.793,167.724h-70.621c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h70.621c4.875,0,8.828,3.953,8.828,8.828l0,0C326.621,163.772,322.668,167.724,317.793,167.724z'/%3e%3c/g%3e%3cg%20style='opacity:0.97;'%3e%3cpath%20style='fill:%23C7CFE2;'%20d='M361.931,203.034H247.172c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h114.759c4.875,0,8.828,3.953,8.828,8.828l0,0C370.759,199.082,366.806,203.034,361.931,203.034z'/%3e%3c/g%3e%3cpath%20style='fill:%2382889D;'%20d='M167.724,414.897c-2.259,0-4.518-0.862-6.241-2.586L135,385.827c-3.448-3.448-3.448-9.035,0-12.483%20c3.448-3.448,9.035-3.448,12.483,0l20.241,20.242l37.897-37.897c3.448-3.448,9.035-3.448,12.483,0c3.448,3.448,3.448,9.035,0,12.483%20l-44.138,44.138C172.242,414.035,169.983,414.897,167.724,414.897z'/%3e%3cg%20style='opacity:0.97;'%3e%3cpath%20style='fill:%23AFB9D2;'%20d='M317.793,379.586h-70.621c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h70.621c4.875,0,8.828,3.953,8.828,8.828l0,0C326.621,375.634,322.668,379.586,317.793,379.586z'/%3e%3c/g%3e%3cg%20style='opacity:0.97;'%3e%3cpath%20style='fill:%23C7CFE2;'%20d='M361.931,414.897H247.172c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h114.759c4.875,0,8.828,3.953,8.828,8.828l0,0C370.759,410.944,366.806,414.897,361.931,414.897z'/%3e%3c/g%3e%3cpath%20style='fill:%2382889D;'%20d='M167.724,308.966c-2.259,0-4.518-0.862-6.241-2.586L135,279.896c-3.448-3.448-3.448-9.035,0-12.483%20c3.448-3.448,9.035-3.448,12.483,0l20.241,20.242l37.897-37.897c3.448-3.448,9.035-3.448,12.483,0c3.448,3.448,3.448,9.035,0,12.483%20l-44.138,44.138C172.242,308.104,169.983,308.966,167.724,308.966z'/%3e%3cg%20style='opacity:0.97;'%3e%3cpath%20style='fill:%23AFB9D2;'%20d='M317.793,273.655h-70.621c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h70.621c4.875,0,8.828,3.953,8.828,8.828l0,0C326.621,269.703,322.668,273.655,317.793,273.655z'/%3e%3c/g%3e%3cg%20style='opacity:0.97;'%3e%3cpath%20style='fill:%23C7CFE2;'%20d='M361.931,308.966H247.172c-4.875,0-8.828-3.953-8.828-8.828l0,0c0-4.875,3.953-8.828,8.828-8.828%20h114.759c4.875,0,8.828,3.953,8.828,8.828l0,0C370.759,305.013,366.806,308.966,361.931,308.966z'/%3e%3c/g%3e%3c/svg%3e";
29
- const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx("img", { src: checkmarkNotepad });
30
- const prefixKey = (key) => `${PLUGIN_ID}.${key}`;
31
- const index = {
32
- register(app) {
33
- app.customFields.register({
34
- name: "multiselect-checkbox",
35
- pluginId: `${PLUGIN_ID}`,
36
- type: "json",
37
- intlLabel: {
38
- id: `${PLUGIN_ID}.label`,
39
- defaultMessage: "Multiselect"
40
- },
41
- intlDescription: {
42
- id: `${PLUGIN_ID}.description`,
43
- defaultMessage: "A custom field for Strapi that allows users to select multiple options from a predefined list."
44
- },
45
- icon: PluginIcon,
46
- components: {
47
- Input: async () => Promise.resolve().then(() => require("./index-8Txh7SeC.js"))
48
- },
49
- options: {
50
- base: [
51
- {
52
- sectionTitle: null,
53
- items: [
54
- {
55
- name: "options.availableOptions",
56
- type: "textarea-enum",
57
- intlLabel: {
58
- id: prefixKey("options.available-options.label"),
59
- defaultMessage: "Available Options"
60
- },
61
- description: {
62
- id: prefixKey("options.available-options.description"),
63
- defaultMessage: "One option per line."
64
- },
65
- placeholder: {
66
- id: prefixKey("options.available-options.placeholder"),
67
- defaultMessage: "Option 1\nOption 2\nOption 3"
68
- }
69
- }
70
- ]
71
- }
72
- ],
73
- //
74
- // Strapi default advanced options.
75
- //
76
- // - See also: https://github.com/strapi/strapi/blob/develop/packages/core/content-type-builder/admin/src/components/FormModal/attributes/attributeOptions.ts
77
- //
78
- advanced: [
79
- {
80
- sectionTitle: {
81
- id: "global.settings",
82
- defaultMessage: "Settings"
83
- },
84
- items: [
85
- {
86
- name: "required",
87
- type: "checkbox",
88
- intlLabel: {
89
- id: "content-type-builder.form.attribute.item.requiredField",
90
- defaultMessage: "Required field"
91
- },
92
- description: {
93
- id: "content-type-builder.form.attribute.item.requiredField.description",
94
- defaultMessage: "You won't be able to create an entry if this field is empty"
95
- }
96
- },
97
- {
98
- name: "private",
99
- type: "checkbox",
100
- intlLabel: {
101
- id: "content-type-builder.form.attribute.item.privateField",
102
- defaultMessage: "Private field"
103
- },
104
- description: {
105
- id: "content-type-builder.form.attribute.item.privateField.description",
106
- defaultMessage: "This field will not show up in the API response"
107
- }
108
- }
109
- ]
110
- }
111
- ]
112
- }
113
- });
114
- app.registerPlugin({
115
- id: PLUGIN_ID,
116
- initializer: Initializer,
117
- isReady: false,
118
- name: PLUGIN_ID
119
- });
120
- },
121
- async registerTrads({ locales }) {
122
- return Promise.all(
123
- locales.map(async (locale) => {
124
- try {
125
- const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-pkXKBXLR.js")) }), `./translations/${locale}.json`, 3);
126
- return { data, locale };
127
- } catch {
128
- return { data: {}, locale };
129
- }
130
- })
131
- );
132
- }
133
- };
134
- exports.index = index;
135
- exports.prefixKey = prefixKey;