@adam-milo/ui 1.0.28 → 1.0.30

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 (161) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +3 -1
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.js +1 -1
  5. package/dist/index11.cjs +1 -1
  6. package/dist/index11.js +1 -1
  7. package/dist/index12.cjs +1 -1
  8. package/dist/index12.js +1 -1
  9. package/dist/index13.cjs +1 -1
  10. package/dist/index13.js +1 -1
  11. package/dist/index14.cjs +1 -1
  12. package/dist/index14.js +1 -1
  13. package/dist/index15.cjs +1 -1
  14. package/dist/index15.js +2 -2
  15. package/dist/index16.cjs +1 -1
  16. package/dist/index16.js +1 -1
  17. package/dist/index17.cjs +1 -1
  18. package/dist/index17.js +1 -1
  19. package/dist/index18.cjs +1 -1
  20. package/dist/index18.js +1 -1
  21. package/dist/index19.cjs +1 -1
  22. package/dist/index19.js +43 -12
  23. package/dist/index2.cjs +1 -1
  24. package/dist/index2.js +1 -1
  25. package/dist/index20.cjs +1 -0
  26. package/dist/index20.js +14 -0
  27. package/dist/index22.cjs +1 -1
  28. package/dist/index22.js +20 -299
  29. package/dist/index23.cjs +1 -1
  30. package/dist/index23.js +298 -13
  31. package/dist/index24.cjs +1 -0
  32. package/dist/index24.js +16 -0
  33. package/dist/{index26.cjs → index27.cjs} +1 -1
  34. package/dist/{index26.js → index27.js} +21 -21
  35. package/dist/index3.cjs +1 -1
  36. package/dist/index3.js +2 -2
  37. package/dist/index4.cjs +1 -1
  38. package/dist/index4.js +1 -1
  39. package/dist/index40.cjs +1 -1
  40. package/dist/index40.js +18 -3
  41. package/dist/index42.cjs +1 -1
  42. package/dist/index42.js +3 -67
  43. package/dist/index43.cjs +1 -1
  44. package/dist/index43.js +6 -34
  45. package/dist/index44.cjs +1 -1
  46. package/dist/index44.js +64 -58
  47. package/dist/index45.cjs +1 -1
  48. package/dist/index45.js +35 -6
  49. package/dist/index46.cjs +1 -1
  50. package/dist/index46.js +53 -201
  51. package/dist/index47.cjs +1 -1
  52. package/dist/index47.js +6 -25
  53. package/dist/index48.cjs +1 -1
  54. package/dist/index48.js +190 -186
  55. package/dist/index49.cjs +1 -1
  56. package/dist/index49.js +24 -9
  57. package/dist/index5.cjs +1 -1
  58. package/dist/index5.js +1 -1
  59. package/dist/index50.cjs +1 -1
  60. package/dist/index50.js +193 -278
  61. package/dist/index51.cjs +1 -1
  62. package/dist/index51.js +11 -15
  63. package/dist/index52.cjs +1 -1
  64. package/dist/index52.js +287 -37
  65. package/dist/index53.cjs +1 -1
  66. package/dist/index53.js +14 -85
  67. package/dist/index54.cjs +1 -1
  68. package/dist/index54.js +38 -9
  69. package/dist/index55.cjs +1 -1
  70. package/dist/index55.js +80 -62
  71. package/dist/index56.cjs +1 -1
  72. package/dist/index56.js +11 -3
  73. package/dist/index57.cjs +1 -1
  74. package/dist/index57.js +66 -9
  75. package/dist/index58.cjs +1 -1
  76. package/dist/index58.js +3 -31
  77. package/dist/index59.cjs +1 -1
  78. package/dist/index59.js +12 -120
  79. package/dist/index6.cjs +1 -1
  80. package/dist/index6.js +2 -2
  81. package/dist/index60.cjs +1 -1
  82. package/dist/index60.js +30 -7
  83. package/dist/index61.cjs +1 -1
  84. package/dist/index61.js +118 -13
  85. package/dist/index62.cjs +1 -1
  86. package/dist/index62.js +7 -293
  87. package/dist/index63.cjs +1 -1
  88. package/dist/index63.js +14 -22
  89. package/dist/index64.cjs +1 -1
  90. package/dist/index64.js +291 -33
  91. package/dist/index65.cjs +1 -1
  92. package/dist/index65.js +22 -622
  93. package/dist/index66.cjs +1 -1
  94. package/dist/index66.js +35 -35
  95. package/dist/index67.cjs +1 -1
  96. package/dist/index67.js +620 -33
  97. package/dist/index68.cjs +1 -1
  98. package/dist/index68.js +37 -5
  99. package/dist/index69.cjs +1 -1
  100. package/dist/index69.js +36 -8
  101. package/dist/index7.cjs +1 -1
  102. package/dist/index7.js +1 -1
  103. package/dist/index70.cjs +1 -1
  104. package/dist/index70.js +5 -3
  105. package/dist/index71.cjs +1 -1
  106. package/dist/index71.js +8 -33
  107. package/dist/index72.cjs +1 -1
  108. package/dist/index72.js +3 -178
  109. package/dist/index73.cjs +1 -1
  110. package/dist/index73.js +31 -17
  111. package/dist/index74.cjs +1 -1
  112. package/dist/index74.js +165 -706
  113. package/dist/index75.cjs +1 -1
  114. package/dist/index75.js +16 -149
  115. package/dist/index76.cjs +1 -1
  116. package/dist/index76.js +697 -149
  117. package/dist/index77.cjs +1 -1
  118. package/dist/index77.js +150 -43
  119. package/dist/index78.cjs +1 -1
  120. package/dist/index78.js +170 -10
  121. package/dist/index79.cjs +1 -1
  122. package/dist/index79.js +83 -14
  123. package/dist/index8.cjs +1 -1
  124. package/dist/index8.js +1 -1
  125. package/dist/index80.cjs +1 -1
  126. package/dist/index80.js +41 -96
  127. package/dist/index81.cjs +1 -1
  128. package/dist/index81.js +10 -85
  129. package/dist/index82.cjs +1 -1
  130. package/dist/index82.js +15 -7
  131. package/dist/index83.cjs +1 -1
  132. package/dist/index83.js +99 -26
  133. package/dist/index84.cjs +1 -1
  134. package/dist/index84.js +8 -34
  135. package/dist/index85.cjs +1 -1
  136. package/dist/index85.js +27 -14
  137. package/dist/index86.cjs +1 -1
  138. package/dist/index86.js +12 -44
  139. package/dist/index87.cjs +1 -1
  140. package/dist/index87.js +44 -5
  141. package/dist/index88.cjs +1 -0
  142. package/dist/index88.js +9 -0
  143. package/dist/index89.cjs +1 -0
  144. package/dist/index89.js +37 -0
  145. package/dist/index9.cjs +1 -1
  146. package/dist/index9.js +2 -2
  147. package/dist/src/components/forms/radio/Radio.component.d.ts.map +1 -1
  148. package/dist/src/components/typography/text/Text.component.d.ts +93 -0
  149. package/dist/src/components/typography/text/Text.component.d.ts.map +1 -0
  150. package/dist/src/index.d.ts +2 -0
  151. package/dist/src/index.d.ts.map +1 -1
  152. package/dist/style.css +1 -1
  153. package/package.json +2 -1
  154. package/dist/index21.cjs +0 -1
  155. package/dist/index21.js +0 -22
  156. package/dist/index38.cjs +0 -1
  157. package/dist/index38.js +0 -21
  158. package/dist/index41.cjs +0 -1
  159. package/dist/index41.js +0 -11
  160. /package/dist/{index34.cjs → index35.cjs} +0 -0
  161. /package/dist/{index34.js → index35.js} +0 -0
package/dist/index80.js CHANGED
@@ -1,102 +1,47 @@
1
- var alwaysContainsScroll = function(node) {
2
- return node.tagName === "TEXTAREA";
3
- };
4
- var elementCanBeScrolled = function(node, overflow) {
5
- if (!(node instanceof Element)) {
6
- return false;
1
+ import * as React from "react";
2
+ import { styleSingleton } from "./index81.js";
3
+ import { noScrollbarsClassName, zeroRightClassName, fullWidthClassName, removedBarSizeVariable } from "./index71.js";
4
+ import { getGapWidth } from "./index89.js";
5
+ var Style = styleSingleton();
6
+ var lockAttribute = "data-scroll-locked";
7
+ var getStyles = function(_a, allowRelative, gapMode, important) {
8
+ var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
9
+ if (gapMode === void 0) {
10
+ gapMode = "margin";
7
11
  }
8
- var styles = window.getComputedStyle(node);
9
- return (
10
- // not-not-scrollable
11
- styles[overflow] !== "hidden" && // contains scroll inside self
12
- !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
13
- );
14
- };
15
- var elementCouldBeVScrolled = function(node) {
16
- return elementCanBeScrolled(node, "overflowY");
17
- };
18
- var elementCouldBeHScrolled = function(node) {
19
- return elementCanBeScrolled(node, "overflowX");
20
- };
21
- var locationCouldBeScrolled = function(axis, node) {
22
- var ownerDocument = node.ownerDocument;
23
- var current = node;
24
- do {
25
- if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
26
- current = current.host;
27
- }
28
- var isScrollable = elementCouldBeScrolled(axis, current);
29
- if (isScrollable) {
30
- var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
31
- if (scrollHeight > clientHeight) {
32
- return true;
12
+ return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
13
+ allowRelative && "position: relative ".concat(important, ";"),
14
+ gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
15
+ gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
16
+ ].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
17
+ };
18
+ var getCurrentUseCounter = function() {
19
+ var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
20
+ return isFinite(counter) ? counter : 0;
21
+ };
22
+ var useLockAttribute = function() {
23
+ React.useEffect(function() {
24
+ document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
25
+ return function() {
26
+ var newCounter = getCurrentUseCounter() - 1;
27
+ if (newCounter <= 0) {
28
+ document.body.removeAttribute(lockAttribute);
29
+ } else {
30
+ document.body.setAttribute(lockAttribute, newCounter.toString());
33
31
  }
34
- }
35
- current = current.parentNode;
36
- } while (current && current !== ownerDocument.body);
37
- return false;
38
- };
39
- var getVScrollVariables = function(_a) {
40
- var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
41
- return [
42
- scrollTop,
43
- scrollHeight,
44
- clientHeight
45
- ];
46
- };
47
- var getHScrollVariables = function(_a) {
48
- var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
49
- return [
50
- scrollLeft,
51
- scrollWidth,
52
- clientWidth
53
- ];
32
+ };
33
+ }, []);
54
34
  };
55
- var elementCouldBeScrolled = function(axis, node) {
56
- return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
57
- };
58
- var getScrollVariables = function(axis, node) {
59
- return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
60
- };
61
- var getDirectionFactor = function(axis, direction) {
62
- return axis === "h" && direction === "rtl" ? -1 : 1;
63
- };
64
- var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
65
- var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
66
- var delta = directionFactor * sourceDelta;
67
- var target = event.target;
68
- var targetInLock = endTarget.contains(target);
69
- var shouldCancelScroll = false;
70
- var isDeltaPositive = delta > 0;
71
- var availableScroll = 0;
72
- var availableScrollTop = 0;
73
- do {
74
- if (!target) {
75
- break;
76
- }
77
- var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
78
- var elementScroll = scroll_1 - capacity - directionFactor * position;
79
- if (position || elementScroll) {
80
- if (elementCouldBeScrolled(axis, target)) {
81
- availableScroll += elementScroll;
82
- availableScrollTop += position;
83
- }
84
- }
85
- var parent_1 = target.parentNode;
86
- target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
87
- } while (
88
- // portaled content
89
- !targetInLock && target !== document.body || // self content
90
- targetInLock && (endTarget.contains(target) || endTarget === target)
91
- );
92
- if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
93
- shouldCancelScroll = true;
94
- } else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
95
- shouldCancelScroll = true;
96
- }
97
- return shouldCancelScroll;
35
+ var RemoveScrollBar = function(_a) {
36
+ var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
37
+ useLockAttribute();
38
+ var gap = React.useMemo(function() {
39
+ return getGapWidth(gapMode);
40
+ }, [gapMode]);
41
+ return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
98
42
  };
99
43
  export {
100
- handleScroll,
101
- locationCouldBeScrolled
44
+ RemoveScrollBar,
45
+ lockAttribute,
46
+ useLockAttribute
102
47
  };
package/dist/index81.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index66.cjs");function r(n){return n}exports.createSidecarMedium=function(e){void 0===e&&(e={});var t=function(n,e){void 0===e&&(e=r);var t=[],u=!1;return{read:function(){if(u)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:n},useMedium:function(n){var r=e(n,u);return t.push(r),function(){t=t.filter(function(n){return n!==r})}},assignSyncMedium:function(n){for(u=!0;t.length;){var r=t;t=[],r.forEach(n)}t={push:function(r){return n(r)},filter:function(){return t}}},assignMedium:function(n){u=!0;var r=[];if(t.length){var e=t;t=[],e.forEach(n),r=t}var i=function(){var e=r;r=[],e.forEach(n)},o=function(){return Promise.resolve().then(i)};o(),t={push:function(n){r.push(n),o()},filter:function(n){return r=r.filter(n),t}}}}}(null);return t.options=n.__assign({async:!0,ssr:!1},e),t};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index86.cjs");exports.styleSingleton=function(){var t=e.styleHookSingleton();return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}};
package/dist/index81.js CHANGED
@@ -1,88 +1,13 @@
1
- import { __assign } from "./index66.js";
2
- function ItoI(a) {
3
- return a;
4
- }
5
- function innerCreateMedium(defaults, middleware) {
6
- if (middleware === void 0) {
7
- middleware = ItoI;
8
- }
9
- var buffer = [];
10
- var assigned = false;
11
- var medium = {
12
- read: function() {
13
- if (assigned) {
14
- throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
15
- }
16
- if (buffer.length) {
17
- return buffer[buffer.length - 1];
18
- }
19
- return defaults;
20
- },
21
- useMedium: function(data) {
22
- var item = middleware(data, assigned);
23
- buffer.push(item);
24
- return function() {
25
- buffer = buffer.filter(function(x) {
26
- return x !== item;
27
- });
28
- };
29
- },
30
- assignSyncMedium: function(cb) {
31
- assigned = true;
32
- while (buffer.length) {
33
- var cbs = buffer;
34
- buffer = [];
35
- cbs.forEach(cb);
36
- }
37
- buffer = {
38
- push: function(x) {
39
- return cb(x);
40
- },
41
- filter: function() {
42
- return buffer;
43
- }
44
- };
45
- },
46
- assignMedium: function(cb) {
47
- assigned = true;
48
- var pendingQueue = [];
49
- if (buffer.length) {
50
- var cbs = buffer;
51
- buffer = [];
52
- cbs.forEach(cb);
53
- pendingQueue = buffer;
54
- }
55
- var executeQueue = function() {
56
- var cbs2 = pendingQueue;
57
- pendingQueue = [];
58
- cbs2.forEach(cb);
59
- };
60
- var cycle = function() {
61
- return Promise.resolve().then(executeQueue);
62
- };
63
- cycle();
64
- buffer = {
65
- push: function(x) {
66
- pendingQueue.push(x);
67
- cycle();
68
- },
69
- filter: function(filter) {
70
- pendingQueue = pendingQueue.filter(filter);
71
- return buffer;
72
- }
73
- };
74
- }
1
+ import { styleHookSingleton } from "./index86.js";
2
+ var styleSingleton = function() {
3
+ var useStyle = styleHookSingleton();
4
+ var Sheet = function(_a) {
5
+ var styles = _a.styles, dynamic = _a.dynamic;
6
+ useStyle(styles, dynamic);
7
+ return null;
75
8
  };
76
- return medium;
77
- }
78
- function createSidecarMedium(options) {
79
- if (options === void 0) {
80
- options = {};
81
- }
82
- var medium = innerCreateMedium(null);
83
- medium.options = __assign({ async: true, ssr: false }, options);
84
- return medium;
85
- }
9
+ return Sheet;
10
+ };
86
11
  export {
87
- createSidecarMedium
12
+ styleSingleton
88
13
  };
package/dist/index82.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.assignRef=function(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=!1;if("undefined"!=typeof window)try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0,!0}});window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(r){e=!1}var n=!!e&&{passive:!1};exports.nonPassive=n;
package/dist/index82.js CHANGED
@@ -1,11 +1,19 @@
1
- function assignRef(ref, value) {
2
- if (typeof ref === "function") {
3
- ref(value);
4
- } else if (ref) {
5
- ref.current = value;
1
+ var passiveSupported = false;
2
+ if (typeof window !== "undefined") {
3
+ try {
4
+ var options = Object.defineProperty({}, "passive", {
5
+ get: function() {
6
+ passiveSupported = true;
7
+ return true;
8
+ }
9
+ });
10
+ window.addEventListener("test", options, options);
11
+ window.removeEventListener("test", options, options);
12
+ } catch (err) {
13
+ passiveSupported = false;
6
14
  }
7
- return ref;
8
15
  }
16
+ var nonPassive = passiveSupported ? { passive: false } : false;
9
17
  export {
10
- assignRef
18
+ nonPassive
11
19
  };
package/dist/index83.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useCallbackRef=function(a,r){var t=e.useState(function(){return{value:a,callback:r,facade:{get current(){return t.value},set current(e){var a=t.value;a!==e&&(t.value=e,t.callback(e,a))}}}})[0];return t.callback=r,t.facade};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var t=function(t,e){if(!(t instanceof Element))return!1;var o=window.getComputedStyle(t);return"hidden"!==o[e]&&!(o.overflowY===o.overflowX&&!function(t){return"TEXTAREA"===t.tagName}(t)&&"visible"===o[e])},e=function(e,o){return"v"===e?function(e){return t(e,"overflowY")}(o):function(e){return t(e,"overflowX")}(o)},o=function(t,e){return"v"===t?[(o=e).scrollTop,o.scrollHeight,o.clientHeight]:function(t){return[t.scrollLeft,t.scrollWidth,t.clientWidth]}(e);var o};exports.handleScroll=function(t,n,r,i,l){var u=function(t,e){return"h"===t&&"rtl"===e?-1:1}(t,window.getComputedStyle(n).direction),a=u*i,c=r.target,d=n.contains(c),f=!1,s=a>0,v=0,h=0;do{if(!c)break;var w=o(t,c),p=w[0],b=w[1]-w[2]-u*p;(p||b)&&e(t,c)&&(v+=b,h+=p);var g=c.parentNode;c=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!d&&c!==document.body||d&&(n.contains(c)||n===c));return(s&&Math.abs(v)<1||!s&&Math.abs(h)<1)&&(f=!0),f},exports.locationCouldBeScrolled=function(t,n){var r=n.ownerDocument,i=n;do{if("undefined"!=typeof ShadowRoot&&i instanceof ShadowRoot&&(i=i.host),e(t,i)){var l=o(t,i);if(l[1]>l[2])return!0}i=i.parentNode}while(i&&i!==r.body);return!1};
package/dist/index83.js CHANGED
@@ -1,29 +1,102 @@
1
- import { useState } from "react";
2
- function useCallbackRef(initialValue, callback) {
3
- var ref = useState(function() {
4
- return {
5
- // value
6
- value: initialValue,
7
- // last callback
8
- callback,
9
- // "memoized" public interface
10
- facade: {
11
- get current() {
12
- return ref.value;
13
- },
14
- set current(value) {
15
- var last = ref.value;
16
- if (last !== value) {
17
- ref.value = value;
18
- ref.callback(value, last);
19
- }
20
- }
1
+ var alwaysContainsScroll = function(node) {
2
+ return node.tagName === "TEXTAREA";
3
+ };
4
+ var elementCanBeScrolled = function(node, overflow) {
5
+ if (!(node instanceof Element)) {
6
+ return false;
7
+ }
8
+ var styles = window.getComputedStyle(node);
9
+ return (
10
+ // not-not-scrollable
11
+ styles[overflow] !== "hidden" && // contains scroll inside self
12
+ !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
13
+ );
14
+ };
15
+ var elementCouldBeVScrolled = function(node) {
16
+ return elementCanBeScrolled(node, "overflowY");
17
+ };
18
+ var elementCouldBeHScrolled = function(node) {
19
+ return elementCanBeScrolled(node, "overflowX");
20
+ };
21
+ var locationCouldBeScrolled = function(axis, node) {
22
+ var ownerDocument = node.ownerDocument;
23
+ var current = node;
24
+ do {
25
+ if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
26
+ current = current.host;
27
+ }
28
+ var isScrollable = elementCouldBeScrolled(axis, current);
29
+ if (isScrollable) {
30
+ var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
31
+ if (scrollHeight > clientHeight) {
32
+ return true;
33
+ }
34
+ }
35
+ current = current.parentNode;
36
+ } while (current && current !== ownerDocument.body);
37
+ return false;
38
+ };
39
+ var getVScrollVariables = function(_a) {
40
+ var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
41
+ return [
42
+ scrollTop,
43
+ scrollHeight,
44
+ clientHeight
45
+ ];
46
+ };
47
+ var getHScrollVariables = function(_a) {
48
+ var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
49
+ return [
50
+ scrollLeft,
51
+ scrollWidth,
52
+ clientWidth
53
+ ];
54
+ };
55
+ var elementCouldBeScrolled = function(axis, node) {
56
+ return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
57
+ };
58
+ var getScrollVariables = function(axis, node) {
59
+ return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
60
+ };
61
+ var getDirectionFactor = function(axis, direction) {
62
+ return axis === "h" && direction === "rtl" ? -1 : 1;
63
+ };
64
+ var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
65
+ var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
66
+ var delta = directionFactor * sourceDelta;
67
+ var target = event.target;
68
+ var targetInLock = endTarget.contains(target);
69
+ var shouldCancelScroll = false;
70
+ var isDeltaPositive = delta > 0;
71
+ var availableScroll = 0;
72
+ var availableScrollTop = 0;
73
+ do {
74
+ if (!target) {
75
+ break;
76
+ }
77
+ var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
78
+ var elementScroll = scroll_1 - capacity - directionFactor * position;
79
+ if (position || elementScroll) {
80
+ if (elementCouldBeScrolled(axis, target)) {
81
+ availableScroll += elementScroll;
82
+ availableScrollTop += position;
21
83
  }
22
- };
23
- })[0];
24
- ref.callback = callback;
25
- return ref.facade;
26
- }
84
+ }
85
+ var parent_1 = target.parentNode;
86
+ target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
87
+ } while (
88
+ // portaled content
89
+ !targetInLock && target !== document.body || // self content
90
+ targetInLock && (endTarget.contains(target) || endTarget === target)
91
+ );
92
+ if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
93
+ shouldCancelScroll = true;
94
+ } else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
95
+ shouldCancelScroll = true;
96
+ }
97
+ return shouldCancelScroll;
98
+ };
27
99
  export {
28
- useCallbackRef
100
+ handleScroll,
101
+ locationCouldBeScrolled
29
102
  };
package/dist/index84.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var t={left:0,top:0,right:0,gap:0},n=function(t){return parseInt(t||"",10)||0};exports.getGapWidth=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return t;var i=function(t){var e=window.getComputedStyle(document.body),i=e["padding"===t?"paddingLeft":"marginLeft"],d=e["padding"===t?"paddingTop":"marginTop"],r=e["padding"===t?"paddingRight":"marginRight"];return[n(i),n(d),n(r)]}(e),d=document.documentElement.clientWidth,r=window.innerWidth;return{left:i[0],top:i[1],right:i[2],gap:Math.max(0,r-d+i[2]-i[0])}},exports.zeroGap=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.assignRef=function(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e};
package/dist/index84.js CHANGED
@@ -1,37 +1,11 @@
1
- var zeroGap = {
2
- left: 0,
3
- top: 0,
4
- right: 0,
5
- gap: 0
6
- };
7
- var parse = function(x) {
8
- return parseInt(x || "", 10) || 0;
9
- };
10
- var getOffset = function(gapMode) {
11
- var cs = window.getComputedStyle(document.body);
12
- var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
13
- var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
14
- var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
15
- return [parse(left), parse(top), parse(right)];
16
- };
17
- var getGapWidth = function(gapMode) {
18
- if (gapMode === void 0) {
19
- gapMode = "margin";
1
+ function assignRef(ref, value) {
2
+ if (typeof ref === "function") {
3
+ ref(value);
4
+ } else if (ref) {
5
+ ref.current = value;
20
6
  }
21
- if (typeof window === "undefined") {
22
- return zeroGap;
23
- }
24
- var offsets = getOffset(gapMode);
25
- var documentWidth = document.documentElement.clientWidth;
26
- var windowWidth = window.innerWidth;
27
- return {
28
- left: offsets[0],
29
- top: offsets[1],
30
- right: offsets[2],
31
- gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
32
- };
33
- };
7
+ return ref;
8
+ }
34
9
  export {
35
- getGapWidth,
36
- zeroGap
10
+ assignRef
37
11
  };
package/dist/index85.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("./index86.cjs");function n(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const r=n(e);exports.styleHookSingleton=function(){var e=t.stylesheetSingleton();return function(t,n){r.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useCallbackRef=function(a,r){var t=e.useState(function(){return{value:a,callback:r,facade:{get current(){return t.value},set current(e){var a=t.value;a!==e&&(t.value=e,t.callback(e,a))}}}})[0];return t.callback=r,t.facade};
package/dist/index85.js CHANGED
@@ -1,16 +1,29 @@
1
- import * as React from "react";
2
- import { stylesheetSingleton } from "./index86.js";
3
- var styleHookSingleton = function() {
4
- var sheet = stylesheetSingleton();
5
- return function(styles, isDynamic) {
6
- React.useEffect(function() {
7
- sheet.add(styles);
8
- return function() {
9
- sheet.remove();
10
- };
11
- }, [styles && isDynamic]);
12
- };
13
- };
1
+ import { useState } from "react";
2
+ function useCallbackRef(initialValue, callback) {
3
+ var ref = useState(function() {
4
+ return {
5
+ // value
6
+ value: initialValue,
7
+ // last callback
8
+ callback,
9
+ // "memoized" public interface
10
+ facade: {
11
+ get current() {
12
+ return ref.value;
13
+ },
14
+ set current(value) {
15
+ var last = ref.value;
16
+ if (last !== value) {
17
+ ref.value = value;
18
+ ref.callback(value, last);
19
+ }
20
+ }
21
+ }
22
+ };
23
+ })[0];
24
+ ref.callback = callback;
25
+ return ref.facade;
26
+ }
14
27
  export {
15
- styleHookSingleton
28
+ useCallbackRef
16
29
  };
package/dist/index86.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index87.cjs");exports.stylesheetSingleton=function(){var t=0,n=null;return{add:function(o){var r,u;0==t&&(n=function(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var n=e.getNonce();return n&&t.setAttribute("nonce",n),t}())&&(u=o,(r=n).styleSheet?r.styleSheet.cssText=u:r.appendChild(document.createTextNode(u)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(n)),t++},remove:function(){! --t&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("./index87.cjs");function n(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const r=n(e);exports.styleHookSingleton=function(){var e=t.stylesheetSingleton();return function(t,n){r.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}};
package/dist/index86.js CHANGED
@@ -1,48 +1,16 @@
1
- import { getNonce } from "./index87.js";
2
- function makeStyleTag() {
3
- if (!document)
4
- return null;
5
- var tag = document.createElement("style");
6
- tag.type = "text/css";
7
- var nonce = getNonce();
8
- if (nonce) {
9
- tag.setAttribute("nonce", nonce);
10
- }
11
- return tag;
12
- }
13
- function injectStyles(tag, css) {
14
- if (tag.styleSheet) {
15
- tag.styleSheet.cssText = css;
16
- } else {
17
- tag.appendChild(document.createTextNode(css));
18
- }
19
- }
20
- function insertStyleTag(tag) {
21
- var head = document.head || document.getElementsByTagName("head")[0];
22
- head.appendChild(tag);
23
- }
24
- var stylesheetSingleton = function() {
25
- var counter = 0;
26
- var stylesheet = null;
27
- return {
28
- add: function(style) {
29
- if (counter == 0) {
30
- if (stylesheet = makeStyleTag()) {
31
- injectStyles(stylesheet, style);
32
- insertStyleTag(stylesheet);
33
- }
34
- }
35
- counter++;
36
- },
37
- remove: function() {
38
- counter--;
39
- if (!counter && stylesheet) {
40
- stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
41
- stylesheet = null;
42
- }
43
- }
1
+ import * as React from "react";
2
+ import { stylesheetSingleton } from "./index87.js";
3
+ var styleHookSingleton = function() {
4
+ var sheet = stylesheetSingleton();
5
+ return function(styles, isDynamic) {
6
+ React.useEffect(function() {
7
+ sheet.add(styles);
8
+ return function() {
9
+ sheet.remove();
10
+ };
11
+ }, [styles && isDynamic]);
44
12
  };
45
13
  };
46
14
  export {
47
- stylesheetSingleton
15
+ styleHookSingleton
48
16
  };
package/dist/index87.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.getNonce=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index88.cjs");exports.stylesheetSingleton=function(){var t=0,n=null;return{add:function(o){var r,u;0==t&&(n=function(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var n=e.getNonce();return n&&t.setAttribute("nonce",n),t}())&&(u=o,(r=n).styleSheet?r.styleSheet.cssText=u:r.appendChild(document.createTextNode(u)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(n)),t++},remove:function(){! --t&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}};
package/dist/index87.js CHANGED
@@ -1,9 +1,48 @@
1
- var getNonce = function() {
2
- if (typeof __webpack_nonce__ !== "undefined") {
3
- return __webpack_nonce__;
1
+ import { getNonce } from "./index88.js";
2
+ function makeStyleTag() {
3
+ if (!document)
4
+ return null;
5
+ var tag = document.createElement("style");
6
+ tag.type = "text/css";
7
+ var nonce = getNonce();
8
+ if (nonce) {
9
+ tag.setAttribute("nonce", nonce);
4
10
  }
5
- return void 0;
11
+ return tag;
12
+ }
13
+ function injectStyles(tag, css) {
14
+ if (tag.styleSheet) {
15
+ tag.styleSheet.cssText = css;
16
+ } else {
17
+ tag.appendChild(document.createTextNode(css));
18
+ }
19
+ }
20
+ function insertStyleTag(tag) {
21
+ var head = document.head || document.getElementsByTagName("head")[0];
22
+ head.appendChild(tag);
23
+ }
24
+ var stylesheetSingleton = function() {
25
+ var counter = 0;
26
+ var stylesheet = null;
27
+ return {
28
+ add: function(style) {
29
+ if (counter == 0) {
30
+ if (stylesheet = makeStyleTag()) {
31
+ injectStyles(stylesheet, style);
32
+ insertStyleTag(stylesheet);
33
+ }
34
+ }
35
+ counter++;
36
+ },
37
+ remove: function() {
38
+ counter--;
39
+ if (!counter && stylesheet) {
40
+ stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
41
+ stylesheet = null;
42
+ }
43
+ }
44
+ };
6
45
  };
7
46
  export {
8
- getNonce
47
+ stylesheetSingleton
9
48
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.getNonce=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__};