@mirai/ui 1.0.225 → 1.0.226

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.
@@ -33,7 +33,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
33
33
  var Layer = function Layer(_ref) {
34
34
  var forceBottom = _ref.bottom,
35
35
  centered = _ref.centered,
36
- fixed = _ref.fixed,
36
+ propFixed = _ref.fixed,
37
37
  _ref$forceRender = _ref.forceRender,
38
38
  forceRender = _ref$forceRender === void 0 ? true : _ref$forceRender,
39
39
  forceLeft = _ref.left,
@@ -49,8 +49,12 @@ var Layer = function Layer(_ref) {
49
49
  var contentRef = (0, _react.useRef)();
50
50
  var _useState = (0, _react.useState)(),
51
51
  _useState2 = _slicedToArray(_useState, 2),
52
- position = _useState2[0],
53
- setPosition = _useState2[1];
52
+ fixed = _useState2[0],
53
+ setFixed = _useState2[1];
54
+ var _useState3 = (0, _react.useState)(),
55
+ _useState4 = _slicedToArray(_useState3, 2),
56
+ position = _useState4[0],
57
+ setPosition = _useState4[1];
54
58
  (0, _react.useLayoutEffect)(function () {
55
59
  var content = contentRef === null || contentRef === void 0 ? void 0 : contentRef.current;
56
60
  if (!content || typeof ResizeObserver === 'undefined') return;
@@ -91,6 +95,7 @@ var Layer = function Layer(_ref) {
91
95
  top = _getLayerPosition$top === void 0 ? 0 : _getLayerPosition$top,
92
96
  _getLayerPosition$ori = _getLayerPosition.orientation,
93
97
  orientation = _getLayerPosition$ori === void 0 ? {} : _getLayerPosition$ori;
98
+ setFixed(propFixed || (0, _helpers2.isComponentFixed)(componentEl));
94
99
  setPosition({
95
100
  left: "".concat(left, "px"),
96
101
  top: "".concat(top, "px")
@@ -1 +1 @@
1
- {"version":3,"file":"Layer.js","names":["Layer","forceBottom","bottom","centered","fixed","forceRender","forceLeft","left","forceRight","right","forceTop","top","timestamp","visible","onPosition","others","device","useDevice","componentRef","useRef","contentRef","useState","position","setPosition","useLayoutEffect","content","current","ResizeObserver","observer","calcPosition","observe","unobserve","componentEl","firstChild","contentEl","componentLayout","getElementLayout","scrollTop","getScrollParent","contentLayout","modal","getModalParent","getLayerPosition","orientation","children","React","Children","map","child","className","contentStyle","style","createWrapper","role","testId","find","name","type","LayerContent","styles","layer","hidden","createElement","Fragment","undefined","propTypes","PropTypes","bool","node","number","func"],"sources":["../../../src/primitives/Layer/Layer.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Primitive } from '../Primitive';\nimport { getElementLayout, getLayerPosition, getModalParent, getScrollParent } from './helpers';\nimport style from './Layer.module.css';\nimport { LayerContent } from './LayerContent';\n\nconst Layer = ({\n bottom: forceBottom,\n centered,\n fixed,\n forceRender = true,\n left: forceLeft,\n right: forceRight,\n top: forceTop,\n timestamp,\n visible,\n onPosition = () => {},\n ...others\n}) => {\n const device = useDevice();\n const componentRef = useRef();\n const contentRef = useRef();\n\n const [position, setPosition] = useState();\n\n useLayoutEffect(() => {\n const content = contentRef?.current;\n if (!content || typeof ResizeObserver === 'undefined') return;\n\n const observer = new ResizeObserver(calcPosition);\n observer.observe(content);\n\n return () => observer.unobserve(content);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(\n () => calcPosition(),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [centered, device, forceBottom, forceLeft, forceRight, forceTop, timestamp, visible],\n );\n\n const calcPosition = () => {\n const { current: { firstChild: componentEl } = {} } = componentRef;\n const { current: contentEl } = contentRef;\n\n if (!componentEl || !contentEl) return setPosition();\n\n const componentLayout = { ...getElementLayout(componentEl), scrollTop: getScrollParent(componentEl)?.scrollTop };\n const contentLayout = getElementLayout(contentEl);\n const modal = getModalParent(componentEl);\n const {\n left = 0,\n top = 0,\n orientation = {},\n } = getLayerPosition(componentLayout, contentLayout, device, modal, {\n centered,\n forceBottom,\n forceLeft,\n forceRight,\n forceTop,\n });\n\n setPosition({ left: `${left}px`, top: `${top}px` });\n onPosition(orientation);\n };\n\n const children = React.Children.map(others.children || [], (child) => child);\n const { className, style: contentStyle } = others;\n const createWrapper = className || contentStyle;\n\n return (\n <>\n <Primitive ref={componentRef} role={others.role || 'layer'} tag=\"span\" testId={others.testId}>\n {children.find(({ type: { name } }) => name !== LayerContent.name)}\n </Primitive>\n\n {(forceRender || visible) && (\n <Primitive\n ref={contentRef}\n role={others.role ? `${others.role}-content` : 'layer-content'}\n className={styles(style.layer, fixed && style.fixed, !visible && style.hidden)}\n style={{ ...position }}\n >\n {React.createElement(\n createWrapper ? 'div' : React.Fragment,\n createWrapper ? { className, style: contentStyle } : undefined,\n children?.find(({ type: { name } }) => name === LayerContent.name),\n )}\n </Primitive>\n )}\n </>\n );\n};\n\nLayer.propTypes = {\n bottom: PropTypes.bool,\n centered: PropTypes.bool,\n children: PropTypes.node,\n fixed: PropTypes.bool,\n forceRender: PropTypes.bool,\n left: PropTypes.bool,\n right: PropTypes.bool,\n timestamp: PropTypes.number,\n top: PropTypes.bool,\n visible: PropTypes.bool,\n onPosition: PropTypes.func,\n};\n\nexport { Layer };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE9C,IAAMA,KAAK,GAAG,SAARA,KAAK,OAYL;EAAA,IAXIC,WAAW,QAAnBC,MAAM;IACNC,QAAQ,QAARA,QAAQ;IACRC,KAAK,QAALA,KAAK;IAAA,wBACLC,WAAW;IAAXA,WAAW,iCAAG,IAAI;IACZC,SAAS,QAAfC,IAAI;IACGC,UAAU,QAAjBC,KAAK;IACAC,QAAQ,QAAbC,GAAG;IACHC,SAAS,QAATA,SAAS;IACTC,OAAO,QAAPA,OAAO;IAAA,uBACPC,UAAU;IAAVA,UAAU,gCAA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3,"file":"Layer.js","names":["Layer","forceBottom","bottom","centered","propFixed","fixed","forceRender","forceLeft","left","forceRight","right","forceTop","top","timestamp","visible","onPosition","others","device","useDevice","componentRef","useRef","contentRef","useState","setFixed","position","setPosition","useLayoutEffect","content","current","ResizeObserver","observer","calcPosition","observe","unobserve","componentEl","firstChild","contentEl","componentLayout","getElementLayout","scrollTop","getScrollParent","contentLayout","modal","getModalParent","getLayerPosition","orientation","isComponentFixed","children","React","Children","map","child","className","contentStyle","style","createWrapper","role","testId","find","name","type","LayerContent","styles","layer","hidden","createElement","Fragment","undefined","propTypes","PropTypes","bool","node","number","func"],"sources":["../../../src/primitives/Layer/Layer.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Primitive } from '../Primitive';\nimport { getElementLayout, getLayerPosition, getModalParent, getScrollParent, isComponentFixed } from './helpers';\nimport style from './Layer.module.css';\nimport { LayerContent } from './LayerContent';\n\nconst Layer = ({\n bottom: forceBottom,\n centered,\n fixed: propFixed,\n forceRender = true,\n left: forceLeft,\n right: forceRight,\n top: forceTop,\n timestamp,\n visible,\n onPosition = () => {},\n ...others\n}) => {\n const device = useDevice();\n const componentRef = useRef();\n const contentRef = useRef();\n\n const [fixed, setFixed] = useState();\n const [position, setPosition] = useState();\n\n useLayoutEffect(() => {\n const content = contentRef?.current;\n if (!content || typeof ResizeObserver === 'undefined') return;\n\n const observer = new ResizeObserver(calcPosition);\n observer.observe(content);\n\n return () => observer.unobserve(content);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(\n () => calcPosition(),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [centered, device, forceBottom, forceLeft, forceRight, forceTop, timestamp, visible],\n );\n\n const calcPosition = () => {\n const { current: { firstChild: componentEl } = {} } = componentRef;\n const { current: contentEl } = contentRef;\n\n if (!componentEl || !contentEl) return setPosition();\n\n const componentLayout = { ...getElementLayout(componentEl), scrollTop: getScrollParent(componentEl)?.scrollTop };\n const contentLayout = getElementLayout(contentEl);\n const modal = getModalParent(componentEl);\n const {\n left = 0,\n top = 0,\n orientation = {},\n } = getLayerPosition(componentLayout, contentLayout, device, modal, {\n centered,\n forceBottom,\n forceLeft,\n forceRight,\n forceTop,\n });\n\n setFixed(propFixed || isComponentFixed(componentEl));\n setPosition({ left: `${left}px`, top: `${top}px` });\n onPosition(orientation);\n };\n\n const children = React.Children.map(others.children || [], (child) => child);\n const { className, style: contentStyle } = others;\n const createWrapper = className || contentStyle;\n\n return (\n <>\n <Primitive ref={componentRef} role={others.role || 'layer'} tag=\"span\" testId={others.testId}>\n {children.find(({ type: { name } }) => name !== LayerContent.name)}\n </Primitive>\n\n {(forceRender || visible) && (\n <Primitive\n ref={contentRef}\n role={others.role ? `${others.role}-content` : 'layer-content'}\n className={styles(style.layer, fixed && style.fixed, !visible && style.hidden)}\n style={{ ...position }}\n >\n {React.createElement(\n createWrapper ? 'div' : React.Fragment,\n createWrapper ? { className, style: contentStyle } : undefined,\n children?.find(({ type: { name } }) => name === LayerContent.name),\n )}\n </Primitive>\n )}\n </>\n );\n};\n\nLayer.propTypes = {\n bottom: PropTypes.bool,\n centered: PropTypes.bool,\n children: PropTypes.node,\n fixed: PropTypes.bool,\n forceRender: PropTypes.bool,\n left: PropTypes.bool,\n right: PropTypes.bool,\n timestamp: PropTypes.number,\n top: PropTypes.bool,\n visible: PropTypes.bool,\n onPosition: PropTypes.func,\n};\n\nexport { Layer };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE9C,IAAMA,KAAK,GAAG,SAARA,KAAK,OAYL;EAAA,IAXIC,WAAW,QAAnBC,MAAM;IACNC,QAAQ,QAARA,QAAQ;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AEsB,kBAAS,CAACE,IAAI;EACxBlE,KAAK,EAAEgE,kBAAS,CAACC,IAAI;EACrBhE,WAAW,EAAE+D,kBAAS,CAACC,IAAI;EAC3B9D,IAAI,EAAE6D,kBAAS,CAACC,IAAI;EACpB5D,KAAK,EAAE2D,kBAAS,CAACC,IAAI;EACrBzD,SAAS,EAAEwD,kBAAS,CAACG,MAAM;EAC3B5D,GAAG,EAAEyD,kBAAS,CAACC,IAAI;EACnBxD,OAAO,EAAEuD,kBAAS,CAACC,IAAI;EACvBvD,UAAU,EAAEsD,kBAAS,CAACI;AACxB,CAAC"}
@@ -55,6 +55,29 @@ exports[`primitive:<Layer> w/ centered && visible 1`] = `
55
55
  </DocumentFragment>
56
56
  `;
57
57
 
58
+ exports[`primitive:<Layer> w/ child fixed 1`] = `
59
+ <DocumentFragment>
60
+ <span>
61
+ <button
62
+ class="pressable button"
63
+ style="position: fixed;"
64
+ >
65
+ Action
66
+ </button>
67
+ </span>
68
+ <div
69
+ class="layer fixed hidden"
70
+ style="left: 0px; top: 0px;"
71
+ >
72
+ <span
73
+ class="text paragraph"
74
+ >
75
+ Mirai
76
+ </span>
77
+ </div>
78
+ </DocumentFragment>
79
+ `;
80
+
58
81
  exports[`primitive:<Layer> w/ component & <LayerContent> 1`] = `
59
82
  <DocumentFragment>
60
83
  <span>
@@ -47,4 +47,15 @@ Object.keys(_getScrollParent).forEach(function (key) {
47
47
  }
48
48
  });
49
49
  });
50
+ var _isComponentFixed = require("./isComponentFixed");
51
+ Object.keys(_isComponentFixed).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _isComponentFixed[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function get() {
57
+ return _isComponentFixed[key];
58
+ }
59
+ });
60
+ });
50
61
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/primitives/Layer/helpers/index.js"],"sourcesContent":["export * from './getElementLayout';\nexport * from './getLayerPosition';\nexport * from './getModalParent';\nexport * from './getScrollParent';\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/primitives/Layer/helpers/index.js"],"sourcesContent":["export * from './getElementLayout';\nexport * from './getLayerPosition';\nexport * from './getModalParent';\nexport * from './getScrollParent';\nexport * from './isComponentFixed';\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isComponentFixed = void 0;
7
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
8
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
+ var isComponentFixed = function isComponentFixed(node) {
11
+ if (!node) return;
12
+ var getValue = function getValue(nodes) {
13
+ if (!(nodes !== null && nodes !== void 0 && nodes.length)) return;
14
+ var _iterator = _createForOfIteratorHelper(nodes),
15
+ _step;
16
+ try {
17
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
18
+ var _node = _step.value;
19
+ var _getComputedStyle = getComputedStyle(_node),
20
+ position = _getComputedStyle.position;
21
+ if (position === 'fixed' || getValue(_node.children)) return true;
22
+ }
23
+ } catch (err) {
24
+ _iterator.e(err);
25
+ } finally {
26
+ _iterator.f();
27
+ }
28
+ };
29
+ return getValue([node]);
30
+ };
31
+ exports.isComponentFixed = isComponentFixed;
32
+ //# sourceMappingURL=isComponentFixed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isComponentFixed.js","names":["isComponentFixed","node","getValue","nodes","length","getComputedStyle","position","children"],"sources":["../../../../src/primitives/Layer/helpers/isComponentFixed.js"],"sourcesContent":["export const isComponentFixed = (node) => {\n if (!node) return;\n\n const getValue = (nodes) => {\n if (!nodes?.length) return;\n\n for (const node of nodes) {\n const { position } = getComputedStyle(node);\n\n if (position === 'fixed' || getValue(node.children)) return true;\n }\n };\n\n return getValue([node]);\n};\n"],"mappings":";;;;;;;;;AAAO,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgB,CAAIC,IAAI,EAAK;EACxC,IAAI,CAACA,IAAI,EAAE;EAEX,IAAMC,QAAQ,GAAG,SAAXA,QAAQ,CAAIC,KAAK,EAAK;IAC1B,IAAI,EAACA,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEC,MAAM,GAAE;IAAO,2CAERD,KAAK;MAAA;IAAA;MAAxB,oDAA0B;QAAA,IAAfF,KAAI;QACb,wBAAqBI,gBAAgB,CAACJ,KAAI,CAAC;UAAnCK,QAAQ,qBAARA,QAAQ;QAEhB,IAAIA,QAAQ,KAAK,OAAO,IAAIJ,QAAQ,CAACD,KAAI,CAACM,QAAQ,CAAC,EAAE,OAAO,IAAI;MAClE;IAAC;MAAA;IAAA;MAAA;IAAA;EACH,CAAC;EAED,OAAOL,QAAQ,CAAC,CAACD,IAAI,CAAC,CAAC;AACzB,CAAC;AAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirai/ui",
3
- "version": "1.0.225",
3
+ "version": "1.0.226",
4
4
  "repository": "git@gitlab.com:miraicorp/dev/frontend/ui.git",
5
5
  "author": "JΛVI <hello@soyjavi.com>",
6
6
  "license": "MIT",