startbit-timezone-select 0.0.0 → 2.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.
Files changed (51) hide show
  1. package/README.md +85 -3
  2. package/dist/admin/App-ApBjpMql.mjs +23 -0
  3. package/dist/admin/App-ApBjpMql.mjs.map +1 -0
  4. package/dist/admin/App-BlTU6Lmm.js +23 -0
  5. package/dist/admin/App-BlTU6Lmm.js.map +1 -0
  6. package/dist/admin/TimeZone-D3r22Lcf.js +66 -0
  7. package/dist/admin/TimeZone-D3r22Lcf.js.map +1 -0
  8. package/dist/admin/TimeZone-piXcAg6n.mjs +66 -0
  9. package/dist/admin/TimeZone-piXcAg6n.mjs.map +1 -0
  10. package/dist/admin/en-B4KWt_jN.js +4 -0
  11. package/dist/admin/en-B4KWt_jN.js.map +1 -0
  12. package/dist/admin/en-Byx4XI2L.mjs +4 -0
  13. package/dist/admin/en-Byx4XI2L.mjs.map +1 -0
  14. package/dist/admin/index-B1af4dDJ.mjs +106 -0
  15. package/dist/admin/index-B1af4dDJ.mjs.map +1 -0
  16. package/dist/admin/index-BEIAVxBW.js +105 -0
  17. package/dist/admin/index-BEIAVxBW.js.map +1 -0
  18. package/dist/admin/index.js +4 -0
  19. package/dist/admin/index.js.map +1 -0
  20. package/dist/admin/index.mjs +4 -0
  21. package/dist/admin/index.mjs.map +1 -0
  22. package/dist/server/index.js +76 -0
  23. package/dist/server/index.mjs +76 -0
  24. package/package.json +54 -31
  25. package/admin/src/components/CustomField.css +0 -110
  26. package/admin/src/components/Initializer/index.js +0 -26
  27. package/admin/src/components/PluginIcon/index.js +0 -12
  28. package/admin/src/components/PluginIcons.js +0 -12
  29. package/admin/src/components/TimeZone.js +0 -70
  30. package/admin/src/index.js +0 -84
  31. package/admin/src/pages/App/index.js +0 -25
  32. package/admin/src/pages/HomePage/index.js +0 -20
  33. package/admin/src/pluginId.js +0 -5
  34. package/admin/src/translations/en.json +0 -1
  35. package/admin/src/translations/fr.json +0 -1
  36. package/admin/src/utils/getTrad.js +0 -5
  37. package/server/bootstrap.js +0 -5
  38. package/server/config/index.js +0 -6
  39. package/server/content-types/index.js +0 -3
  40. package/server/controllers/index.js +0 -7
  41. package/server/controllers/my-controller.js +0 -10
  42. package/server/destroy.js +0 -5
  43. package/server/index.js +0 -25
  44. package/server/middlewares/index.js +0 -3
  45. package/server/policies/index.js +0 -3
  46. package/server/register.js +0 -10
  47. package/server/routes/index.js +0 -10
  48. package/server/services/index.js +0 -7
  49. package/server/services/my-service.js +0 -7
  50. package/strapi-admin.js +0 -3
  51. package/strapi-server.js +0 -3
@@ -0,0 +1,76 @@
1
+ const bootstrap = ({ strapi }) => {
2
+ };
3
+ const destroy = ({ strapi }) => {
4
+ };
5
+ const register = ({ strapi }) => {
6
+ strapi.customFields.register({
7
+ name: "timeZone",
8
+ plugin: "startbit-timezone-select",
9
+ type: "string",
10
+ inputSize: {
11
+ default: 6,
12
+ isResizable: true
13
+ }
14
+ });
15
+ };
16
+ const config = {
17
+ default: {},
18
+ validator() {
19
+ }
20
+ };
21
+ const contentTypes = {};
22
+ const controller = ({ strapi }) => ({
23
+ index(ctx) {
24
+ ctx.body = strapi.plugin("startbit-timezone-select").service("service").getWelcomeMessage();
25
+ }
26
+ });
27
+ const controllers = {
28
+ controller
29
+ };
30
+ const middlewares = {};
31
+ const policies = {};
32
+ const contentAPIRoutes = () => ({
33
+ type: "content-api",
34
+ routes: [
35
+ {
36
+ method: "GET",
37
+ path: "/",
38
+ // name of the controller file & the method.
39
+ handler: "controller.index",
40
+ config: {
41
+ policies: []
42
+ }
43
+ }
44
+ ]
45
+ });
46
+ const adminAPIRoutes = () => ({
47
+ type: "admin",
48
+ routes: []
49
+ });
50
+ const routes = {
51
+ "content-api": contentAPIRoutes,
52
+ admin: adminAPIRoutes
53
+ };
54
+ const service = ({ strapi }) => ({
55
+ getWelcomeMessage() {
56
+ return "Welcome to Strapi 🚀";
57
+ }
58
+ });
59
+ const services = {
60
+ service
61
+ };
62
+ const index = {
63
+ bootstrap,
64
+ destroy,
65
+ register,
66
+ config,
67
+ controllers,
68
+ contentTypes,
69
+ middlewares,
70
+ policies,
71
+ routes,
72
+ services
73
+ };
74
+ export {
75
+ index as default
76
+ };
package/package.json CHANGED
@@ -1,43 +1,66 @@
1
1
  {
2
- "name": "startbit-timezone-select",
3
- "version": "0.0.0",
4
- "description": "This is the description of the plugin.",
5
- "strapi": {
6
- "name": "startbit-timezone-select",
7
- "description": "Description of Startbit Timezone Select plugin",
8
- "kind": "plugin",
9
- "displayName": "Startbit Timezone Select"
2
+ "version": "2.0.0",
3
+ "keywords": [],
4
+ "type": "commonjs",
5
+ "exports": {
6
+ "./package.json": "./package.json",
7
+ "./strapi-admin": {
8
+ "source": "./admin/src/index.js",
9
+ "import": "./dist/admin/index.mjs",
10
+ "require": "./dist/admin/index.js",
11
+ "default": "./dist/admin/index.js"
12
+ },
13
+ "./strapi-server": {
14
+ "source": "./server/src/index.js",
15
+ "import": "./dist/server/index.mjs",
16
+ "require": "./dist/server/index.js",
17
+ "default": "./dist/server/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "scripts": {
24
+ "build": "strapi-plugin build",
25
+ "watch": "strapi-plugin watch",
26
+ "watch:link": "strapi-plugin watch:link",
27
+ "verify": "strapi-plugin verify"
10
28
  },
11
29
  "dependencies": {
12
- "@strapi/design-system": "^1.6.3",
13
- "@strapi/helper-plugin": "^4.6.0",
14
- "@strapi/icons": "^1.6.3",
15
- "prop-types": "^15.7.2"
30
+ "react-select": "^5.10.2",
31
+ "react-timezone-select": "^3.3.2"
16
32
  },
17
33
  "devDependencies": {
34
+ "@strapi/design-system": "^2.0.0-rc.30",
35
+ "@strapi/icons": "^2.0.0-rc.30",
36
+ "@strapi/sdk-plugin": "^6.0.0",
37
+ "@strapi/strapi": "^5.36.1",
38
+ "prettier": "^3.8.1",
18
39
  "react": "^18.2.0",
19
40
  "react-dom": "^18.2.0",
20
- "react-router-dom": "^5.3.4",
21
- "styled-components": "^5.3.6"
41
+ "react-intl": "^7.0.0",
42
+ "react-router-dom": "^6.30.3",
43
+ "styled-components": "^6.3.11"
22
44
  },
23
45
  "peerDependencies": {
24
- "react": "^17.0.0 || ^18.0.0",
25
- "react-dom": "^17.0.0 || ^18.0.0",
26
- "react-router-dom": "^5.2.0",
27
- "styled-components": "^5.2.1",
28
- "react-timezone-select": "^3.2.8"
46
+ "@strapi/design-system": "^2.0.0-rc.30",
47
+ "@strapi/icons": "^2.0.0-rc.30",
48
+ "@strapi/sdk-plugin": "^6.0.0",
49
+ "@strapi/strapi": "^5.36.1",
50
+ "react": "^18.3.1",
51
+ "react-dom": "^18.3.1",
52
+ "react-intl": "^8.1.3",
53
+ "react-router-dom": "^6.30.3",
54
+ "styled-components": "^6.3.11"
29
55
  },
30
- "author": {
31
- "name": "A Strapi developer"
32
- },
33
- "maintainers": [
34
- {
35
- "name": "A Strapi developer"
36
- }
37
- ],
38
- "engines": {
39
- "node": ">=18.0.0 <=20.x.x",
40
- "npm": ">=6.0.0"
56
+ "strapi": {
57
+ "kind": "plugin",
58
+ "name": "startbit-timezone-select",
59
+ "displayName": "Startbit Timezone Select",
60
+ "description": "Startbit Timezone Select is a Strapi plugin that adds a custom Timezone field, allowing users to select and display time zones listing in UTC format."
41
61
  },
42
- "license": "MIT"
62
+ "name": "startbit-timezone-select",
63
+ "description": "Startbit Timezone Select is a Strapi plugin that adds a custom Timezone field, allowing users to select and display time zones listing in UTC format.",
64
+ "license": "MIT",
65
+ "author": "Startbit <info@startbitsolutions.com>"
43
66
  }
@@ -1,110 +0,0 @@
1
- .toggle-slider .toggle-label {
2
- margin-bottom: 5px;
3
- }
4
- .toggle-slider span:first-child {
5
- align-items: center;
6
- display: flex;
7
- margin-right: 8px;
8
- }
9
- .toggle-slider span:last-child {
10
- align-items: center;
11
- display: flex;
12
- margin-left: 8px;
13
- }
14
- .toggle-slider span.slider {
15
- margin: 0px;
16
- }
17
- .toggle-slider .toggle-content {
18
- display: flex;
19
- }
20
- .toggle-slider .switch {
21
- position: relative;
22
- display: inline-block;
23
- width: 60px;
24
- height: 34px;
25
- }
26
-
27
- .toggle-slider .switch input {
28
- opacity: 0;
29
- width: 0;
30
- height: 0;
31
- }
32
-
33
- .toggle-slider .slider {
34
- position: absolute;
35
- cursor: pointer;
36
- top: 0;
37
- left: 0;
38
- right: 0;
39
- bottom: 0;
40
- background-color: #ccc;
41
- -webkit-transition: 0.4s;
42
- transition: 0.4s;
43
- }
44
-
45
- .toggle-slider .slider:before {
46
- position: absolute;
47
- content: "";
48
- height: 26px;
49
- width: 26px;
50
- left: 4px;
51
- bottom: 4px;
52
- background-color: white;
53
- -webkit-transition: 0.4s;
54
- transition: 0.4s;
55
- }
56
-
57
- .toggle-slider input:checked + .slider {
58
- background-color: #171a1f;
59
- }
60
-
61
- .toggle-slider input:focus + .slider {
62
- box-shadow: 0 0 1px #171a1f;
63
- }
64
-
65
- .toggle-slider input:checked + .slider:before {
66
- -webkit-transform: translateX(26px);
67
- -ms-transform: translateX(26px);
68
- transform: translateX(26px);
69
- }
70
-
71
- /* Rounded sliders */
72
- .toggle-slider .slider.round {
73
- border-radius: 34px;
74
- }
75
-
76
- .toggle-slider .slider.round:before {
77
- border-radius: 50%;
78
- }
79
-
80
- .table-container {
81
- overflow-y: auto; /* Add vertical scrolling */
82
- margin-top: 20px;
83
- }
84
-
85
- .sms-container {
86
- display: noned;
87
- }
88
-
89
- .group-buttons .button {
90
- padding: 7px 12px;
91
- cursor: pointer;
92
- }
93
- .action-buttons {
94
- display: block;
95
- margin: 13px auto;
96
- }
97
-
98
- .group-buttons .button {
99
- background: #ffff;
100
- color: #000;
101
- border: 1px solid #f2f2f2;
102
- }
103
-
104
- .group-buttons .button.active {
105
- background: #565e6d;
106
- color: #fff;
107
- }
108
- .sms-participants table input[type="checkbox"] {
109
- cursor: pointer;
110
- }
@@ -1,26 +0,0 @@
1
- /**
2
- *
3
- * Initializer
4
- *
5
- */
6
-
7
- import { useEffect, useRef } from 'react';
8
- import PropTypes from 'prop-types';
9
- import pluginId from '../../pluginId';
10
-
11
- const Initializer = ({ setPlugin }) => {
12
- const ref = useRef();
13
- ref.current = setPlugin;
14
-
15
- useEffect(() => {
16
- ref.current(pluginId);
17
- }, []);
18
-
19
- return null;
20
- };
21
-
22
- Initializer.propTypes = {
23
- setPlugin: PropTypes.func.isRequired,
24
- };
25
-
26
- export default Initializer;
@@ -1,12 +0,0 @@
1
- /**
2
- *
3
- * PluginIcon
4
- *
5
- */
6
-
7
- import React from 'react';
8
- import { Clock } from '@strapi/icons';
9
-
10
- const PluginIcon = () => <Clock />;
11
-
12
- export default PluginIcon;
@@ -1,12 +0,0 @@
1
- /**
2
- *
3
- * PluginIcon
4
- *
5
- */
6
-
7
- import React from 'react';
8
- import { Clock } from '@strapi/icons';
9
-
10
- export const TimezoneIcon = () => <Clock />
11
-
12
-
@@ -1,70 +0,0 @@
1
- import React, { useState, useEffect } from "react";
2
- import { SingleSelect, SingleSelectOption, Typography } from "@strapi/design-system";
3
- import { useIntl } from "react-intl";
4
- import { useTimezoneSelect, allTimezones } from "react-timezone-select";
5
-
6
- const TimeZone = ({ attribute, disabled, intlLabel, name, onChange, required, value }) => {
7
- const { formatMessage } = useIntl();
8
- const [hasError, setHasError] = useState(false);
9
-
10
- const labelStyle = "original";
11
- const displayValue = "UTC";
12
- const timezones = {
13
- ...allTimezones,
14
- "Europe/Berlin": "Frankfurt",
15
- };
16
- const { options, parseTimezone } = useTimezoneSelect({
17
- labelStyle,
18
- timezones,
19
- displayValue,
20
- });
21
-
22
- useEffect(() => {
23
- if (required && (!value || value === "")) {
24
- setHasError(true);
25
- } else {
26
- setHasError(false);
27
- }
28
- }, [value, required]);
29
-
30
- const handleChange = (selectedOption) => {
31
- // If required, check if the value is empty
32
- if (required && !selectedOption) {
33
- setHasError(true);
34
- } else {
35
- setHasError(false);
36
- }
37
-
38
- onChange({
39
- target: { name, type: attribute.type, value: selectedOption },
40
- });
41
- };
42
-
43
- return (
44
- <div className="Timezone sc-bdvvtL sc-gsDKAQ bOQZK hFpgBC">
45
- <Typography textColor="neutral800">
46
- {formatMessage(intlLabel)}
47
- </Typography>
48
- <SingleSelect
49
- name={name}
50
- onChange={handleChange}
51
- value={value || ""}
52
- required={required}
53
- disabled={disabled}
54
- >
55
- {/* Default option for placeholder */}
56
- <SingleSelectOption value="" >
57
- {formatMessage({ id: "select.any.timezone", defaultMessage: "Select any timezone" })}
58
- </SingleSelectOption>
59
- {options.map((timezone, index) => (
60
- <SingleSelectOption key={index} value={timezone?.value}>{timezone?.label}</SingleSelectOption>
61
- ))}
62
- </SingleSelect>
63
- {required && hasError && (
64
- <p style={{ color: 'red' }}>This field is required.</p> // Display error message
65
- )}
66
- </div>
67
- );
68
- };
69
-
70
- export default TimeZone;
@@ -1,84 +0,0 @@
1
- import { prefixPluginTranslations } from '@strapi/helper-plugin';
2
- import pluginPkg from '../../package.json';
3
- import pluginId from './pluginId';
4
- import Initializer from './components/Initializer';
5
- import PluginIcon from './components/PluginIcon';
6
- import {TimezoneIcon} from './components/PluginIcons';
7
- //import "./components/CustomField.css"; // Import CSS file
8
-
9
- const name = pluginPkg.strapi.name;
10
-
11
- export default {
12
- register(app) {
13
- app.registerPlugin({
14
- id: pluginId,
15
- initializer: Initializer,
16
- isReady: false,
17
- name,
18
- });
19
- app.customFields.register([
20
- {
21
- name: "timeZone",
22
- pluginId: pluginId,
23
- type: "string", // Store the timezone value as a string
24
- intlLabel: {
25
- id: `${pluginId}.timeZone.name`,
26
- defaultMessage: "Timezone",
27
- },
28
- intlDescription: {
29
- id: `${pluginId}.timeZone.description`,
30
- defaultMessage: "Dynamic TimeZone listing",
31
- },
32
- icon: PluginIcon,
33
- components: {
34
- Input: async () =>
35
- import(/* webpackChunkName: "input-component" */ "./components/TimeZone"),
36
- },
37
- options: {
38
- advanced: [
39
- {
40
- sectionTitle: {
41
- id: 'global.advanced',
42
- defaultMessage: 'Settings',
43
- },
44
- items: [
45
- {
46
- intlLabel: { id: 'global.required', defaultMessage: 'Required' },
47
- name: 'required',
48
- type: 'checkbox',
49
- description: {
50
- id: 'global.required.description',
51
- defaultMessage: 'Make this field required',
52
- },
53
- },
54
- ],
55
- },
56
- ],
57
- },
58
- }
59
- ]);
60
- },
61
-
62
- bootstrap(app) {},
63
- async registerTrads({ locales }) {
64
- const importedTrads = await Promise.all(
65
- locales.map((locale) => {
66
- return import(`./translations/${locale}.json`)
67
- .then(({ default: data }) => {
68
- return {
69
- data: prefixPluginTranslations(data, pluginId),
70
- locale,
71
- };
72
- })
73
- .catch(() => {
74
- return {
75
- data: {},
76
- locale,
77
- };
78
- });
79
- })
80
- );
81
-
82
- return Promise.resolve(importedTrads);
83
- },
84
- };
@@ -1,25 +0,0 @@
1
- /**
2
- *
3
- * This component is the skeleton around the actual pages, and should only
4
- * contain code that should be seen on all pages. (e.g. navigation bar)
5
- *
6
- */
7
-
8
- import React from 'react';
9
- import { Switch, Route } from 'react-router-dom';
10
- import { AnErrorOccurred } from '@strapi/helper-plugin';
11
- import pluginId from '../../pluginId';
12
- import HomePage from '../HomePage';
13
-
14
- const App = () => {
15
- return (
16
- <div>
17
- <Switch>
18
- <Route path={`/plugins/${pluginId}`} component={HomePage} exact />
19
- <Route component={AnErrorOccurred} />
20
- </Switch>
21
- </div>
22
- );
23
- };
24
-
25
- export default App;
@@ -1,20 +0,0 @@
1
- /*
2
- *
3
- * HomePage
4
- *
5
- */
6
-
7
- import React from 'react';
8
- // import PropTypes from 'prop-types';
9
- import pluginId from '../../pluginId';
10
-
11
- const HomePage = () => {
12
- return (
13
- <div>
14
- <h1>{pluginId}&apos;s HomePage</h1>
15
- <p>Happy coding</p>
16
- </div>
17
- );
18
- };
19
-
20
- export default HomePage;
@@ -1,5 +0,0 @@
1
- import pluginPkg from '../../package.json';
2
-
3
- const pluginId = pluginPkg.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, '');
4
-
5
- export default pluginId;
@@ -1 +0,0 @@
1
- {}
@@ -1 +0,0 @@
1
- {}
@@ -1,5 +0,0 @@
1
- import pluginId from '../pluginId';
2
-
3
- const getTrad = (id) => `${pluginId}.${id}`;
4
-
5
- export default getTrad;
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = ({ strapi }) => {
4
- // bootstrap phase
5
- };
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- default: {},
5
- validator() {},
6
- };
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {};
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- const myController = require('./my-controller');
4
-
5
- module.exports = {
6
- myController,
7
- };
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = ({ strapi }) => ({
4
- index(ctx) {
5
- ctx.body = strapi
6
- .plugin('startbit-timezone-select')
7
- .service('myService')
8
- .getWelcomeMessage();
9
- },
10
- });
package/server/destroy.js DELETED
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = ({ strapi }) => {
4
- // destroy phase
5
- };
package/server/index.js DELETED
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- const register = require('./register');
4
- const bootstrap = require('./bootstrap');
5
- const destroy = require('./destroy');
6
- const config = require('./config');
7
- const contentTypes = require('./content-types');
8
- const controllers = require('./controllers');
9
- const routes = require('./routes');
10
- const middlewares = require('./middlewares');
11
- const policies = require('./policies');
12
- const services = require('./services');
13
-
14
- module.exports = {
15
- register,
16
- bootstrap,
17
- destroy,
18
- config,
19
- controllers,
20
- routes,
21
- services,
22
- contentTypes,
23
- policies,
24
- middlewares,
25
- };
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {};
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {};
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = ({ strapi }) => {
4
- // register phase
5
- strapi.customFields.register([{
6
- name: "timeZone",
7
- plugin: "startbit-timezone-select",
8
- type: "string",
9
- }]);
10
- };
@@ -1,10 +0,0 @@
1
- module.exports = [
2
- {
3
- method: 'GET',
4
- path: '/',
5
- handler: 'myController.index',
6
- config: {
7
- policies: [],
8
- },
9
- },
10
- ];
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- const myService = require('./my-service');
4
-
5
- module.exports = {
6
- myService,
7
- };
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = ({ strapi }) => ({
4
- getWelcomeMessage() {
5
- return 'Welcome to Strapi 🚀';
6
- },
7
- });