@dbmx/toasts 0.0.19 → 0.0.21

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,22 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ var HelloWorld = function HelloWorld(_ref) {
6
+ var name = _ref.name;
7
+ return /*#__PURE__*/React.createElement("div", {
8
+ style: {
9
+ backgroundColor: '#cfe8ff60',
10
+ padding: 15
11
+ }
12
+ }, /*#__PURE__*/React.createElement("h2", null, "testing react component"), /*#__PURE__*/React.createElement("p", null, "Your name is: ", /*#__PURE__*/React.createElement("i", {
13
+ style: {
14
+ color: '#9c9c9c'
15
+ }
16
+ }, name)), /*#__PURE__*/React.createElement("input", {
17
+ type: "text",
18
+ placeholder: "filter"
19
+ }));
20
+ };
21
+
22
+ module.exports = HelloWorld;
package/cjs/index.cjs CHANGED
@@ -1,37 +1,68 @@
1
1
  'use strict';
2
2
 
3
- var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.cjs');
4
- var React = require('react');
5
-
6
- function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, default: e }); }
3
+ // import { lazy } from 'react'
7
4
 
8
5
  var importPath = '@dbmx/toasts';
9
- var type = importPath;
10
- var tag = 'toast';
11
- var toasts = [{
6
+ // const type = importPath
7
+ // const tag = 'toast'
8
+
9
+ var toasts = [
10
+ // {
11
+ // id: 'sdmxDatagrid',
12
+ // importPath,
13
+ // type,
14
+ // tag,
15
+ // name: 'SDMX Datagrid',
16
+ // tech: 'react',
17
+ // description:
18
+ // 'SDMX, which stands for Statistical Data and Metadata eXchange, is an international initiative that aims at standardising and modernising ("industrialising") the mechanisms and processes for the exchange of statistical data and metadata among international organisations and their member countries.',
19
+ // component: lazy(async () => {
20
+ // const obj = await import('./components/SdmxDatagrid/index.jsx')
21
+ // return typeof obj.default === 'function' ? obj : obj.default
22
+ // }),
23
+ // image: '/images/toasts/sdmx_datagrid.png', // TODO
24
+ // props: {
25
+ // endpoint: {
26
+ // type: 'url',
27
+ // required: true,
28
+ // },
29
+ // resourceType: {
30
+ // type: 'select',
31
+ // required: true,
32
+ // defaultValue: 'dataflow',
33
+ // data: [
34
+ // { value: 'dataflow', label: 'Dataflow' },
35
+ // { value: 'datastructure', label: 'DataStructure' },
36
+ // { value: 'dataproviderscheme', label: 'DataProvider' },
37
+ // ],
38
+ // },
39
+ // agencyID: {
40
+ // type: 'string',
41
+ // required: true,
42
+ // defaultValue: '*',
43
+ // },
44
+ // id: {
45
+ // type: 'string',
46
+ // required: true,
47
+ // },
48
+ // version: {
49
+ // type: 'string',
50
+ // required: true,
51
+ // defaultValue: '~',
52
+ // },
53
+ // },
54
+ // },
55
+
56
+ {
12
57
  id: 'sdmxDatagrid',
13
58
  importPath: importPath,
14
- type: type,
15
- tag: tag,
59
+ brand: 'web-component',
60
+ tag: 'sdmx-datagrid',
16
61
  name: 'SDMX Datagrid',
17
- tech: 'react',
18
62
  description: 'SDMX, which stands for Statistical Data and Metadata eXchange, is an international initiative that aims at standardising and modernising ("industrialising") the mechanisms and processes for the exchange of statistical data and metadata among international organisations and their member countries.',
19
- component: /*#__PURE__*/React.lazy( /*#__PURE__*/_rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
20
- var obj;
21
- return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
22
- while (1) switch (_context.prev = _context.next) {
23
- case 0:
24
- _context.next = 2;
25
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./components/SdmxDatagrid/index.cjs')); });
26
- case 2:
27
- obj = _context.sent;
28
- return _context.abrupt("return", typeof obj["default"] === 'function' ? obj : obj["default"]);
29
- case 4:
30
- case "end":
31
- return _context.stop();
32
- }
33
- }, _callee);
34
- }))),
63
+ "import": function _import() {
64
+ return Promise.resolve().then(function () { return require('./webComponents/SDMXDatagrid/index.cjs'); });
65
+ },
35
66
  image: '/images/toasts/sdmx_datagrid.png',
36
67
  // TODO
37
68
  props: {
@@ -72,12 +103,11 @@ var toasts = [{
72
103
  }, {
73
104
  id: 'helloWorld',
74
105
  importPath: '@dbmx/webComponents',
75
- type: '@dbmx/webComponents',
106
+ brand: 'web-component',
76
107
  tag: 'hello-world',
77
108
  name: 'Hello World',
78
- tech: 'web-component',
79
109
  description: 'web component demonstration',
80
- component: function component() {
110
+ "import": function _import() {
81
111
  return Promise.resolve().then(function () { return require('./webComponents/HelloWorld/index.cjs'); });
82
112
  },
83
113
  image: 'https://ui.mantine.dev/_next/static/media/comments-light.9c0747c0.svg',
@@ -3,23 +3,8 @@
3
3
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.cjs');
4
4
  var React = require('react');
5
5
  var client = require('../../node_modules/react-dom/client.cjs');
6
+ var index = require('../../components/HelloWorld/index.cjs');
6
7
 
7
- var Component = function Component(_ref) {
8
- var name = _ref.name;
9
- return /*#__PURE__*/React.createElement("div", {
10
- style: {
11
- backgroundColor: '#cfe8ff60',
12
- padding: 15
13
- }
14
- }, /*#__PURE__*/React.createElement("h2", null, "testing react component"), /*#__PURE__*/React.createElement("p", null, "Your name is: ", /*#__PURE__*/React.createElement("i", {
15
- style: {
16
- color: '#9c9c9c'
17
- }
18
- }, name)), /*#__PURE__*/React.createElement("input", {
19
- type: "text",
20
- placeholder: "filter"
21
- }));
22
- };
23
8
  var HelloWorld = /*#__PURE__*/function (_HTMLElement) {
24
9
  _rollupPluginBabelHelpers.inherits(HelloWorld, _HTMLElement);
25
10
  var _super = _rollupPluginBabelHelpers.createSuper(HelloWorld);
@@ -30,14 +15,14 @@ var HelloWorld = /*#__PURE__*/function (_HTMLElement) {
30
15
  args[_key] = arguments[_key];
31
16
  }
32
17
  _this = _super.call.apply(_super, [this].concat(args));
33
- _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "setName", void 0);
34
- _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "HelloWorldContainer", function () {
35
- var _useState = React.useState(_this.getAttribute('name')),
36
- _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
37
- name = _useState2[0],
38
- updateName = _useState2[1];
39
- _this.setName = updateName;
40
- return /*#__PURE__*/React.createElement(Component, {
18
+ _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "forceUpdateComponent", void 0);
19
+ _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "container", function () {
20
+ var forceUpdate = React.useReducer(function () {
21
+ return {};
22
+ }, {})[1];
23
+ _this.forceUpdateComponent = forceUpdate;
24
+ var name = _this.getAttribute('name');
25
+ return /*#__PURE__*/React.createElement(index, {
41
26
  name: name
42
27
  });
43
28
  });
@@ -51,16 +36,12 @@ var HelloWorld = /*#__PURE__*/function (_HTMLElement) {
51
36
  mode: 'open'
52
37
  }).appendChild(mountPoint);
53
38
  var root = client.createRoot(mountPoint);
54
- root.render( /*#__PURE__*/React.createElement(this.HelloWorldContainer, null));
39
+ root.render( /*#__PURE__*/React.createElement(this.container, null));
55
40
  }
56
41
  }, {
57
42
  key: "attributeChangedCallback",
58
- value: function attributeChangedCallback(attrName, oldValue, newValue) {
59
- if (attrName === 'name') {
60
- if (typeof this.setName === 'function') {
61
- this.setName(newValue);
62
- }
63
- }
43
+ value: function attributeChangedCallback() {
44
+ if (typeof this.forceUpdateComponent === 'function') this.forceUpdateComponent();
64
45
  }
65
46
  }], [{
66
47
  key: "observedAttributes",
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.cjs');
4
+ var React = require('react');
5
+ var client = require('../../node_modules/react-dom/client.cjs');
6
+ var reactIntl = require('react-intl');
7
+ var core = require('@mantine/core');
8
+ var index = require('../../components/SdmxDatagrid/index.cjs');
9
+
10
+ var SDMXDatagrid = /*#__PURE__*/function (_HTMLElement) {
11
+ _rollupPluginBabelHelpers.inherits(SDMXDatagrid, _HTMLElement);
12
+ var _super = _rollupPluginBabelHelpers.createSuper(SDMXDatagrid);
13
+ function SDMXDatagrid() {
14
+ var _this;
15
+ _rollupPluginBabelHelpers.classCallCheck(this, SDMXDatagrid);
16
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
17
+ args[_key] = arguments[_key];
18
+ }
19
+ _this = _super.call.apply(_super, [this].concat(args));
20
+ _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "forceUpdateComponent", void 0);
21
+ _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "container", function () {
22
+ var forceUpdate = React.useReducer(function () {
23
+ return {};
24
+ }, {})[1];
25
+ _this.forceUpdateComponent = forceUpdate;
26
+ var props = {
27
+ endpoint: _this.getAttribute('endpoint'),
28
+ resourceType: _this.getAttribute('resourceType'),
29
+ agencyID: _this.getAttribute('agencyID'),
30
+ id: _this.getAttribute('id'),
31
+ version: _this.getAttribute('version')
32
+ };
33
+ var containerProps = _this.getAttribute('containerProps') || {};
34
+ var containerPropsValue = typeof containerProps === 'string' ? JSON.parse(containerProps) : {};
35
+ return /*#__PURE__*/React.createElement(reactIntl.IntlProvider, {
36
+ defaultLocale: "en",
37
+ locale: "en",
38
+ messages: {}
39
+ }, /*#__PURE__*/React.createElement("div", containerPropsValue, /*#__PURE__*/React.createElement(index, props)));
40
+ });
41
+ return _this;
42
+ }
43
+ _rollupPluginBabelHelpers.createClass(SDMXDatagrid, [{
44
+ key: "connectedCallback",
45
+ value: function connectedCallback() {
46
+ var shadowRoot = this.attachShadow({
47
+ mode: 'open'
48
+ });
49
+ var mountPoint = document.createElement('div');
50
+ var emotionRoot = document.createElement('div');
51
+ shadowRoot.appendChild(mountPoint);
52
+ shadowRoot.appendChild(emotionRoot);
53
+ var appendCache = core.createEmotionCache({
54
+ key: 'mantine-wc',
55
+ container: emotionRoot
56
+ });
57
+ var root = client.createRoot(mountPoint);
58
+ root.render( /*#__PURE__*/React.createElement(core.MantineProvider, {
59
+ emotionCache: appendCache,
60
+ withGlobalStyles: true,
61
+ withNormalizeCSS: true
62
+ }, /*#__PURE__*/React.createElement(reactIntl.IntlProvider, {
63
+ defaultLocale: "en",
64
+ locale: "en",
65
+ messages: {}
66
+ }, /*#__PURE__*/React.createElement(this.container, null))));
67
+ }
68
+ }, {
69
+ key: "attributeChangedCallback",
70
+ value: function attributeChangedCallback() {
71
+ if (typeof this.forceUpdateComponent === 'function') this.forceUpdateComponent();
72
+ }
73
+ }], [{
74
+ key: "observedAttributes",
75
+ get: function get() {
76
+ return ['endpoint', 'resourceType', 'agencyID', 'id', 'version'];
77
+ }
78
+ }]);
79
+ return SDMXDatagrid;
80
+ }( /*#__PURE__*/_rollupPluginBabelHelpers.wrapNativeSuper(HTMLElement));
81
+ customElements.define('sdmx-datagrid', SDMXDatagrid);