@loadsmart/miranda-react 1.111.0-alpha.1 → 1.111.0-alpha.3

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/dist/index.js CHANGED
@@ -4,12 +4,110 @@ import * as React from 'react';
4
4
  import { forwardRef, useState, useCallback, useRef, useEffect } from 'react';
5
5
  import { jsxs, jsx } from 'react/jsx-runtime';
6
6
 
7
+ function _extends() {
8
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
9
+ for (var i = 1; i < arguments.length; i++) {
10
+ var source = arguments[i];
11
+ for (var key in source) {
12
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
13
+ target[key] = source[key];
14
+ }
15
+ }
16
+ }
17
+ return target;
18
+ };
19
+ return _extends.apply(this, arguments);
20
+ }
21
+ function _unsupportedIterableToArray(o, minLen) {
22
+ if (!o) return;
23
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
24
+ var n = Object.prototype.toString.call(o).slice(8, -1);
25
+ if (n === "Object" && o.constructor) n = o.constructor.name;
26
+ if (n === "Map" || n === "Set") return Array.from(o);
27
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
28
+ }
29
+ function _arrayLikeToArray(arr, len) {
30
+ if (len == null || len > arr.length) len = arr.length;
31
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
32
+ return arr2;
33
+ }
34
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
35
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
36
+ if (it) return (it = it.call(o)).next.bind(it);
37
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
38
+ if (it) o = it;
39
+ var i = 0;
40
+ return function () {
41
+ if (i >= o.length) return {
42
+ done: true
43
+ };
44
+ return {
45
+ done: false,
46
+ value: o[i++]
47
+ };
48
+ };
49
+ }
50
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
51
+ }
52
+
7
53
  /**
8
54
  * @license
9
55
  * Copyright 2018 Google LLC
10
56
  * SPDX-License-Identifier: BSD-3-Clause
11
57
  */
12
- const e=new Set(["children","localName","ref","style","className"]),n=new WeakMap,t=(e,t,o,l,a)=>{const s=a?.[t];void 0===s?(e[t]=o,null==o&&t in HTMLElement.prototype&&e.removeAttribute(t)):o!==l&&((e,t,o)=>{let l=n.get(e);void 0===l&&n.set(e,l=new Map);let a=l.get(t);void 0!==o?void 0===a?(l.set(t,a={handleEvent:o}),e.addEventListener(t,a)):a.handleEvent=o:void 0!==a&&(l.delete(t),e.removeEventListener(t,a));})(e,s,o);},o=({react:n,tagName:o,elementClass:l,events:a,displayName:s})=>{const c=new Set(Object.keys(a??{})),r=n.forwardRef(((s,r)=>{const i=n.useRef(new Map),d=n.useRef(null),f={},u={};for(const[n,t]of Object.entries(s))e.has(n)?f["className"===n?"class":n]=t:c.has(n)||n in l.prototype?u[n]=t:f[n]=t;return n.useLayoutEffect((()=>{if(null===d.current)return;const e=new Map;for(const n in u)t(d.current,n,s[n],i.current.get(n),a),i.current.delete(n),e.set(n,s[n]);for(const[e,n]of i.current)t(d.current,e,void 0,n,a);i.current=e;})),n.useLayoutEffect((()=>{d.current?.removeAttribute("defer-hydration");}),[]),f.suppressHydrationWarning=!0,n.createElement(o,{...f,ref:n.useCallback((e=>{d.current=e,"function"==typeof r?r(e):null!==r&&(r.current=e);}),[r])})}));return r.displayName=s??l.name,r};
58
+ var e = new Set(["children", "localName", "ref", "style", "className"]),
59
+ n = new WeakMap(),
60
+ t = function t(e, _t, o, l, a) {
61
+ var s = a == null ? void 0 : a[_t];
62
+ void 0 === s ? (e[_t] = o, null == o && _t in HTMLElement.prototype && e.removeAttribute(_t)) : o !== l && function (e, t, o) {
63
+ var l = n.get(e);
64
+ void 0 === l && n.set(e, l = new Map());
65
+ var a = l.get(t);
66
+ void 0 !== o ? void 0 === a ? (l.set(t, a = {
67
+ handleEvent: o
68
+ }), e.addEventListener(t, a)) : a.handleEvent = o : void 0 !== a && (l["delete"](t), e.removeEventListener(t, a));
69
+ }(e, s, o);
70
+ },
71
+ o = function o(_ref) {
72
+ var n = _ref.react,
73
+ o = _ref.tagName,
74
+ l = _ref.elementClass,
75
+ a = _ref.events,
76
+ s = _ref.displayName;
77
+ var c = new Set(Object.keys(a != null ? a : {})),
78
+ r = n.forwardRef(function (s, r) {
79
+ var i = n.useRef(new Map()),
80
+ d = n.useRef(null),
81
+ f = {},
82
+ u = {};
83
+ for (var _i = 0, _Object$entries = Object.entries(s); _i < _Object$entries.length; _i++) {
84
+ var _Object$entries$_i = _Object$entries[_i],
85
+ _n = _Object$entries$_i[0],
86
+ _t2 = _Object$entries$_i[1];
87
+ e.has(_n) ? f["className" === _n ? "class" : _n] = _t2 : c.has(_n) || _n in l.prototype ? u[_n] = _t2 : f[_n] = _t2;
88
+ }
89
+ return n.useLayoutEffect(function () {
90
+ if (null === d.current) return;
91
+ var e = new Map();
92
+ for (var _n2 in u) t(d.current, _n2, s[_n2], i.current.get(_n2), a), i.current["delete"](_n2), e.set(_n2, s[_n2]);
93
+ for (var _iterator = _createForOfIteratorHelperLoose(i.current), _step; !(_step = _iterator()).done;) {
94
+ var _step$value = _step.value,
95
+ _e = _step$value[0],
96
+ _n3 = _step$value[1];
97
+ t(d.current, _e, void 0, _n3, a);
98
+ }
99
+ i.current = e;
100
+ }), n.useLayoutEffect(function () {
101
+ var _d$current;
102
+ (_d$current = d.current) == null || _d$current.removeAttribute("defer-hydration");
103
+ }, []), f.suppressHydrationWarning = !0, n.createElement(o, _extends({}, f, {
104
+ ref: n.useCallback(function (e) {
105
+ d.current = e, "function" == typeof r ? r(e) : null !== r && (r.current = e);
106
+ }, [r])
107
+ }));
108
+ });
109
+ return r.displayName = s != null ? s : l.name, r;
110
+ };
13
111
 
14
112
  const createComponent = ({ subComponents, ...options }) => {
15
113
  const ReactComponent = o({
@@ -0,0 +1,2 @@
1
+ /* Used only to expose the file in the published library */
2
+ @import "@loadsmart/miranda-tokens/dist/tokens/web/loadsmart/variables.css";
@@ -0,0 +1,3 @@
1
+ /* Used only to expose the file in the published library */
2
+ @import "@loadsmart/miranda-tokens/dist/tokens/web/loadsmart/variables.scss";
3
+
package/dist/tokens.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Ideally, we should be fowarding the export from miranda-wc package here, like so:
3
- * export * from '@loadsmart/miranda-wc/tokens'
3
+ * `export * from '@loadsmart/miranda-wc/tokens'`
4
4
  * However, during build time, the entry point `/tokens` does not exist, so the
5
- * typecheck and lint fails, that's why we have kep miranda-tokens as a dep, and
5
+ * typecheck and lint fail, that's why we have kept miranda-tokens as a dep, and
6
6
  * added its export here.
7
7
  */
8
8
  export * from '@loadsmart/miranda-tokens';
package/package.json CHANGED
@@ -1,25 +1,12 @@
1
1
  {
2
2
  "name": "@loadsmart/miranda-react",
3
- "version": "1.111.0-alpha.1",
3
+ "version": "1.111.0-alpha.3",
4
4
  "description": "React component library based on Miranda Web Components",
5
- "type": "module",
6
5
  "main": "dist/index.js",
7
6
  "types": "dist/index.d.ts",
8
7
  "files": [
9
8
  "dist"
10
9
  ],
11
- "exports": {
12
- ".": {
13
- "types": "./dist/index.d.ts",
14
- "default": "./dist/index.js"
15
- },
16
- "./tokens": {
17
- "types": "./dist/tokens.d.ts",
18
- "default": "./dist/tokens.js"
19
- },
20
- "./tokens/web/loadsmart.css": "./dist/src/styles/variables.css",
21
- "./tokens/web/loadsmart.scss": "./dist/src/styles/variables.scss"
22
- },
23
10
  "scripts": {
24
11
  "build-docs": "storybook build -o ./docs",
25
12
  "dev": "storybook dev -p 7007",
@@ -53,8 +40,8 @@
53
40
  "access": "public"
54
41
  },
55
42
  "dependencies": {
56
- "@loadsmart/miranda-tokens": "2.94.0-alpha.1",
57
- "@loadsmart/miranda-wc": "1.125.0-alpha.1",
43
+ "@loadsmart/miranda-tokens": "2.94.0-alpha.3",
44
+ "@loadsmart/miranda-wc": "1.125.0-alpha.3",
58
45
  "@lit/react": "^1.0.5"
59
46
  },
60
47
  "directories": {
@@ -1,2 +0,0 @@
1
- /* used only for expose the file in the published library */
2
- @import "@loadsmart/miranda-tokens/themes/web/loadsmart.css";
@@ -1,2 +0,0 @@
1
- /* used only for expose the file in the published library */
2
- @import "@loadsmart/miranda-tokens/themes/web/loadsmart.scss";