@iris-ui-kit/react 0.1.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 (154) hide show
  1. package/LICENSE +21 -0
  2. package/dist/SidebarLayout-fWQRvK0a.d.cts +26 -0
  3. package/dist/SidebarLayout-fWQRvK0a.d.ts +26 -0
  4. package/dist/admin.cjs +1583 -0
  5. package/dist/admin.cjs.map +1 -0
  6. package/dist/admin.d.cts +183 -0
  7. package/dist/admin.d.ts +183 -0
  8. package/dist/admin.js +9 -0
  9. package/dist/admin.js.map +1 -0
  10. package/dist/async.cjs +97 -0
  11. package/dist/async.cjs.map +1 -0
  12. package/dist/async.d.cts +57 -0
  13. package/dist/async.d.ts +57 -0
  14. package/dist/async.js +5 -0
  15. package/dist/async.js.map +1 -0
  16. package/dist/behaviors.cjs +569 -0
  17. package/dist/behaviors.cjs.map +1 -0
  18. package/dist/behaviors.d.cts +188 -0
  19. package/dist/behaviors.d.ts +188 -0
  20. package/dist/behaviors.js +4 -0
  21. package/dist/behaviors.js.map +1 -0
  22. package/dist/chunk-2TQSTINK.js +541 -0
  23. package/dist/chunk-2TQSTINK.js.map +1 -0
  24. package/dist/chunk-53KFLVIZ.js +68 -0
  25. package/dist/chunk-53KFLVIZ.js.map +1 -0
  26. package/dist/chunk-6BMFMCMQ.js +140 -0
  27. package/dist/chunk-6BMFMCMQ.js.map +1 -0
  28. package/dist/chunk-AUA5GBT6.js +143 -0
  29. package/dist/chunk-AUA5GBT6.js.map +1 -0
  30. package/dist/chunk-DE6V6NOI.js +122 -0
  31. package/dist/chunk-DE6V6NOI.js.map +1 -0
  32. package/dist/chunk-HEJGN6UI.js +78 -0
  33. package/dist/chunk-HEJGN6UI.js.map +1 -0
  34. package/dist/chunk-IDD35UJ6.js +83 -0
  35. package/dist/chunk-IDD35UJ6.js.map +1 -0
  36. package/dist/chunk-J5FB2UB2.js +166 -0
  37. package/dist/chunk-J5FB2UB2.js.map +1 -0
  38. package/dist/chunk-OMOTUHYI.js +66 -0
  39. package/dist/chunk-OMOTUHYI.js.map +1 -0
  40. package/dist/chunk-RZNYIFV2.js +34 -0
  41. package/dist/chunk-RZNYIFV2.js.map +1 -0
  42. package/dist/chunk-SJO74IB3.js +54 -0
  43. package/dist/chunk-SJO74IB3.js.map +1 -0
  44. package/dist/chunk-SORLRLS4.js +53 -0
  45. package/dist/chunk-SORLRLS4.js.map +1 -0
  46. package/dist/chunk-TO7YVSAI.js +64 -0
  47. package/dist/chunk-TO7YVSAI.js.map +1 -0
  48. package/dist/chunk-TQ33XJIK.js +22 -0
  49. package/dist/chunk-TQ33XJIK.js.map +1 -0
  50. package/dist/chunk-UWUUEZCD.js +950 -0
  51. package/dist/chunk-UWUUEZCD.js.map +1 -0
  52. package/dist/chunk-VWCJJRSC.js +1200 -0
  53. package/dist/chunk-VWCJJRSC.js.map +1 -0
  54. package/dist/chunk-WIHBIDVJ.js +54 -0
  55. package/dist/chunk-WIHBIDVJ.js.map +1 -0
  56. package/dist/chunk-XCK4RIXB.js +66 -0
  57. package/dist/chunk-XCK4RIXB.js.map +1 -0
  58. package/dist/chunk-YAHXR2CJ.js +48 -0
  59. package/dist/chunk-YAHXR2CJ.js.map +1 -0
  60. package/dist/chunk-YXIO5THG.js +4 -0
  61. package/dist/chunk-YXIO5THG.js.map +1 -0
  62. package/dist/chunk-ZKBDUWUD.js +156 -0
  63. package/dist/chunk-ZKBDUWUD.js.map +1 -0
  64. package/dist/data.cjs +112 -0
  65. package/dist/data.cjs.map +1 -0
  66. package/dist/data.d.cts +53 -0
  67. package/dist/data.d.ts +53 -0
  68. package/dist/data.js +5 -0
  69. package/dist/data.js.map +1 -0
  70. package/dist/error-boundary.cjs +106 -0
  71. package/dist/error-boundary.cjs.map +1 -0
  72. package/dist/error-boundary.d.cts +41 -0
  73. package/dist/error-boundary.d.ts +41 -0
  74. package/dist/error-boundary.js +6 -0
  75. package/dist/error-boundary.js.map +1 -0
  76. package/dist/floating.cjs +163 -0
  77. package/dist/floating.cjs.map +1 -0
  78. package/dist/floating.d.cts +92 -0
  79. package/dist/floating.d.ts +92 -0
  80. package/dist/floating.js +5 -0
  81. package/dist/floating.js.map +1 -0
  82. package/dist/form.cjs +159 -0
  83. package/dist/form.cjs.map +1 -0
  84. package/dist/form.d.cts +120 -0
  85. package/dist/form.d.ts +120 -0
  86. package/dist/form.js +5 -0
  87. package/dist/form.js.map +1 -0
  88. package/dist/i18n.cjs +100 -0
  89. package/dist/i18n.cjs.map +1 -0
  90. package/dist/i18n.d.cts +50 -0
  91. package/dist/i18n.d.ts +50 -0
  92. package/dist/i18n.js +5 -0
  93. package/dist/i18n.js.map +1 -0
  94. package/dist/index.cjs +16635 -0
  95. package/dist/index.cjs.map +1 -0
  96. package/dist/index.d.cts +2964 -0
  97. package/dist/index.d.ts +2964 -0
  98. package/dist/index.js +12217 -0
  99. package/dist/index.js.map +1 -0
  100. package/dist/layouts.cjs +386 -0
  101. package/dist/layouts.cjs.map +1 -0
  102. package/dist/layouts.d.cts +92 -0
  103. package/dist/layouts.d.ts +92 -0
  104. package/dist/layouts.js +6 -0
  105. package/dist/layouts.js.map +1 -0
  106. package/dist/modal-utils.cjs +168 -0
  107. package/dist/modal-utils.cjs.map +1 -0
  108. package/dist/modal-utils.d.cts +43 -0
  109. package/dist/modal-utils.d.ts +43 -0
  110. package/dist/modal-utils.js +4 -0
  111. package/dist/modal-utils.js.map +1 -0
  112. package/dist/motion.cjs +104 -0
  113. package/dist/motion.cjs.map +1 -0
  114. package/dist/motion.d.cts +41 -0
  115. package/dist/motion.d.ts +41 -0
  116. package/dist/motion.js +4 -0
  117. package/dist/motion.js.map +1 -0
  118. package/dist/provider.cjs +191 -0
  119. package/dist/provider.cjs.map +1 -0
  120. package/dist/provider.d.cts +62 -0
  121. package/dist/provider.d.ts +62 -0
  122. package/dist/provider.js +8 -0
  123. package/dist/provider.js.map +1 -0
  124. package/dist/resource.cjs +61 -0
  125. package/dist/resource.cjs.map +1 -0
  126. package/dist/resource.d.cts +21 -0
  127. package/dist/resource.d.ts +21 -0
  128. package/dist/resource.js +5 -0
  129. package/dist/resource.js.map +1 -0
  130. package/dist/skeletons.cjs +1304 -0
  131. package/dist/skeletons.cjs.map +1 -0
  132. package/dist/skeletons.d.cts +70 -0
  133. package/dist/skeletons.d.ts +70 -0
  134. package/dist/skeletons.js +8 -0
  135. package/dist/skeletons.js.map +1 -0
  136. package/dist/skins.cjs +134 -0
  137. package/dist/skins.cjs.map +1 -0
  138. package/dist/skins.d.cts +45 -0
  139. package/dist/skins.d.ts +45 -0
  140. package/dist/skins.js +5 -0
  141. package/dist/skins.js.map +1 -0
  142. package/dist/theme.cjs +100 -0
  143. package/dist/theme.cjs.map +1 -0
  144. package/dist/theme.d.cts +71 -0
  145. package/dist/theme.d.ts +71 -0
  146. package/dist/theme.js +5 -0
  147. package/dist/theme.js.map +1 -0
  148. package/dist/undo.cjs +73 -0
  149. package/dist/undo.cjs.map +1 -0
  150. package/dist/undo.d.cts +47 -0
  151. package/dist/undo.d.ts +47 -0
  152. package/dist/undo.js +4 -0
  153. package/dist/undo.js.map +1 -0
  154. package/package.json +61 -0
@@ -0,0 +1,168 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ var React2 = require('react');
5
+
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
25
+
26
+ // src/modal-utils/useBodyScrollLock.ts
27
+ var lockCount = 0;
28
+ var savedOverflow = null;
29
+ var savedPaddingRight = null;
30
+ var appliedOverflow = null;
31
+ var appliedPaddingRight = null;
32
+ function lock() {
33
+ if (typeof document === "undefined") return;
34
+ lockCount += 1;
35
+ if (lockCount > 1) return;
36
+ const body = document.body;
37
+ const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
38
+ savedOverflow = body.style.overflow;
39
+ savedPaddingRight = body.style.paddingRight;
40
+ body.style.overflow = "hidden";
41
+ appliedOverflow = "hidden";
42
+ if (scrollbarWidth > 0) {
43
+ const currentPadding = parseFloat(getComputedStyle(body).paddingRight || "0");
44
+ appliedPaddingRight = `${currentPadding + scrollbarWidth}px`;
45
+ body.style.paddingRight = appliedPaddingRight;
46
+ } else {
47
+ appliedPaddingRight = null;
48
+ }
49
+ }
50
+ function unlock() {
51
+ if (typeof document === "undefined") return;
52
+ lockCount = Math.max(0, lockCount - 1);
53
+ if (lockCount > 0) return;
54
+ const body = document.body;
55
+ if (body.style.overflow === appliedOverflow) {
56
+ body.style.overflow = savedOverflow ?? "";
57
+ }
58
+ if (appliedPaddingRight !== null && body.style.paddingRight === appliedPaddingRight) {
59
+ body.style.paddingRight = savedPaddingRight ?? "";
60
+ }
61
+ savedOverflow = null;
62
+ savedPaddingRight = null;
63
+ appliedOverflow = null;
64
+ appliedPaddingRight = null;
65
+ }
66
+ function useBodyScrollLock(active) {
67
+ React2__namespace.useEffect(() => {
68
+ if (!active) return;
69
+ lock();
70
+ return () => {
71
+ unlock();
72
+ };
73
+ }, [active]);
74
+ }
75
+ function __getBodyScrollLockCount() {
76
+ return lockCount;
77
+ }
78
+ function __resetBodyScrollLock() {
79
+ lockCount = 0;
80
+ savedOverflow = null;
81
+ savedPaddingRight = null;
82
+ appliedOverflow = null;
83
+ appliedPaddingRight = null;
84
+ if (typeof document !== "undefined") {
85
+ document.body.style.overflow = "";
86
+ document.body.style.paddingRight = "";
87
+ }
88
+ }
89
+ var FOCUSABLE_SELECTOR = [
90
+ "a[href]",
91
+ "area[href]",
92
+ "button:not([disabled])",
93
+ 'input:not([disabled]):not([type="hidden"])',
94
+ "select:not([disabled])",
95
+ "textarea:not([disabled])",
96
+ '[tabindex]:not([tabindex="-1"])',
97
+ '[contenteditable="true"]',
98
+ "audio[controls]",
99
+ "video[controls]",
100
+ "iframe",
101
+ "object",
102
+ "embed"
103
+ ].join(",");
104
+ function getFocusable(root) {
105
+ return Array.from(root.querySelectorAll(FOCUSABLE_SELECTOR)).filter(
106
+ (el) => !el.hasAttribute("disabled") && el.tabIndex !== -1
107
+ );
108
+ }
109
+ function useFocusTrap(options) {
110
+ const { container, active, returnFocusTo, initialFocus = true } = options;
111
+ const previouslyFocusedRef = React2__namespace.useRef(null);
112
+ React2__namespace.useEffect(() => {
113
+ if (!active) return;
114
+ if (typeof document === "undefined") return;
115
+ previouslyFocusedRef.current = document.activeElement ?? null;
116
+ const onKeyDown = (event) => {
117
+ if (event.key !== "Tab") return;
118
+ const root = container.current;
119
+ if (!root) return;
120
+ const focusables = getFocusable(root);
121
+ if (focusables.length === 0) {
122
+ event.preventDefault();
123
+ root.focus();
124
+ return;
125
+ }
126
+ const first = focusables[0];
127
+ const last = focusables[focusables.length - 1];
128
+ const active2 = document.activeElement;
129
+ if (event.shiftKey) {
130
+ if (active2 === first || !root.contains(active2)) {
131
+ event.preventDefault();
132
+ last.focus();
133
+ }
134
+ } else {
135
+ if (active2 === last || !root.contains(active2)) {
136
+ event.preventDefault();
137
+ first.focus();
138
+ }
139
+ }
140
+ };
141
+ document.addEventListener("keydown", onKeyDown);
142
+ let raf;
143
+ if (initialFocus) {
144
+ raf = requestAnimationFrame(() => {
145
+ const root = container.current;
146
+ if (!root) return;
147
+ const focusables = getFocusable(root);
148
+ (focusables[0] ?? root).focus();
149
+ });
150
+ }
151
+ return () => {
152
+ document.removeEventListener("keydown", onKeyDown);
153
+ if (raf !== void 0) cancelAnimationFrame(raf);
154
+ const target = returnFocusTo?.current ?? previouslyFocusedRef.current;
155
+ requestAnimationFrame(() => {
156
+ if (target && target.isConnected) target.focus?.();
157
+ });
158
+ previouslyFocusedRef.current = null;
159
+ };
160
+ }, [active, container, returnFocusTo, initialFocus]);
161
+ }
162
+
163
+ exports.__getBodyScrollLockCount = __getBodyScrollLockCount;
164
+ exports.__resetBodyScrollLock = __resetBodyScrollLock;
165
+ exports.useBodyScrollLock = useBodyScrollLock;
166
+ exports.useFocusTrap = useFocusTrap;
167
+ //# sourceMappingURL=modal-utils.cjs.map
168
+ //# sourceMappingURL=modal-utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/modal-utils/useBodyScrollLock.ts","../src/modal-utils/useFocusTrap.ts"],"names":["React","React2","active"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAI,SAAA,GAAY,CAAA;AAChB,IAAI,aAAA,GAA+B,IAAA;AACnC,IAAI,iBAAA,GAAmC,IAAA;AAGvC,IAAI,eAAA,GAAiC,IAAA;AACrC,IAAI,mBAAA,GAAqC,IAAA;AAEzC,SAAS,IAAA,GAAa;AACpB,EAAA,IAAI,OAAO,aAAa,WAAA,EAAa;AACrC,EAAA,SAAA,IAAa,CAAA;AACb,EAAA,IAAI,YAAY,CAAA,EAAG;AACnB,EAAA,MAAM,OAAO,QAAA,CAAS,IAAA;AACtB,EAAA,MAAM,cAAA,GAAiB,MAAA,CAAO,UAAA,GAAa,QAAA,CAAS,eAAA,CAAgB,WAAA;AACpE,EAAA,aAAA,GAAgB,KAAK,KAAA,CAAM,QAAA;AAC3B,EAAA,iBAAA,GAAoB,KAAK,KAAA,CAAM,YAAA;AAC/B,EAAA,IAAA,CAAK,MAAM,QAAA,GAAW,QAAA;AACtB,EAAA,eAAA,GAAkB,QAAA;AAClB,EAAA,IAAI,iBAAiB,CAAA,EAAG;AACtB,IAAA,MAAM,iBAAiB,UAAA,CAAW,gBAAA,CAAiB,IAAI,CAAA,CAAE,gBAAgB,GAAG,CAAA;AAC5E,IAAA,mBAAA,GAAsB,CAAA,EAAG,iBAAiB,cAAc,CAAA,EAAA,CAAA;AACxD,IAAA,IAAA,CAAK,MAA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AW,SAAS,CAAA;AACjD,MAAA,IAAI,GAAA,KAAQ,MAAA,EAAW,oBAAA,CAAqB,GAAG,CAAA;AAC/C,MAAA,MAAM,MAAA,GAAS,aAAA,EAAe,OAAA,IAAW,oBAAA,CAAqB,OAAA;AAC9D,MAAA,qBAAA,CAAsB,MAAM;AAI1B,QAAA,IAAI,MAAA,IAAU,MAAA,CAAO,WAAA,EAAa,MAAA,CAAO,KAAA,IAAQ;AAAA,MACnD,CAAC,CAAA;AACD,MAAA,oBAAA,CAAqB,OAAA,GAAU,IAAA;AAAA,IACjC,CAAA;AAAA,EACF,GAAG,CAAC,MAAA,EAAQ,SAAA,EAAW,aAAA,EAAe,YAAY,CAAC,CAAA;AACrD","file":"modal-utils.cjs","sourcesContent":["import * as React from 'react'\n\nlet lockCount = 0\nlet savedOverflow: string | null = null\nlet savedPaddingRight: string | null = null\n// What we actually wrote, so unlock can detect a host mutation made while\n// locked and avoid clobbering it.\nlet appliedOverflow: string | null = null\nlet appliedPaddingRight: string | null = null\n\nfunction lock(): void {\n if (typeof document === 'undefined') return\n lockCount += 1\n if (lockCount > 1) return\n const body = document.body\n const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth\n savedOverflow = body.style.overflow\n savedPaddingRight = body.style.paddingRight\n body.style.overflow = 'hidden'\n appliedOverflow = 'hidden'\n if (scrollbarWidth > 0) {\n const currentPadding = parseFloat(getComputedStyle(body).paddingRight || '0')\n appliedPaddingRight = `${currentPadding + scrollbarWidth}px`\n body.style.paddingRight = appliedPaddingRight\n } else {\n appliedPaddingRight = null\n }\n}\n\nfunction unlock(): void {\n if (typeof document === 'undefined') return\n lockCount = Math.max(0, lockCount - 1)\n if (lockCount > 0) return\n const body = document.body\n // Only restore if our locked value is still in place; if a host changed body\n // overflow / padding-right while locked, respect that rather than clobber it.\n if (body.style.overflow === appliedOverflow) {\n body.style.overflow = savedOverflow ?? ''\n }\n if (appliedPaddingRight !== null && body.style.paddingRight === appliedPaddingRight) {\n body.style.paddingRight = savedPaddingRight ?? ''\n }\n savedOverflow = null\n savedPaddingRight = null\n appliedOverflow = null\n appliedPaddingRight = null\n}\n\n/**\n * Lock the document body's scroll while `active` is true. Reference-counted\n * so multiple stacked overlays cooperate. Restores prior `overflow` and\n * `padding-right` (to compensate for the scrollbar gap) when the last lock\n * releases. SSR-safe.\n */\nexport function useBodyScrollLock(active: boolean): void {\n React.useEffect(() => {\n if (!active) return\n lock()\n return () => {\n unlock()\n }\n }, [active])\n}\n\n/** Test-only: read the current lock count. */\nexport function __getBodyScrollLockCount(): number {\n return lockCount\n}\n\n/** Test-only: hard-reset the module-level lock state. */\nexport function __resetBodyScrollLock(): void {\n lockCount = 0\n savedOverflow = null\n savedPaddingRight = null\n appliedOverflow = null\n appliedPaddingRight = null\n if (typeof document !== 'undefined') {\n document.body.style.overflow = ''\n document.body.style.paddingRight = ''\n }\n}\n","import * as React from 'react'\n\nconst FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'area[href]',\n 'button:not([disabled])',\n 'input:not([disabled]):not([type=\"hidden\"])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])',\n '[contenteditable=\"true\"]',\n 'audio[controls]',\n 'video[controls]',\n 'iframe',\n 'object',\n 'embed',\n].join(',')\n\nfunction getFocusable(root: HTMLElement): HTMLElement[] {\n return Array.from(root.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).filter(\n (el) => !el.hasAttribute('disabled') && el.tabIndex !== -1,\n )\n}\n\nexport interface UseFocusTrapOptions {\n /** Element whose Tab key cycle is being trapped. */\n container: React.RefObject<HTMLElement | null>\n /** Whether the trap is currently active. */\n active: boolean\n /** Element to restore focus to when the trap deactivates. */\n returnFocusTo?: React.RefObject<HTMLElement | null | undefined>\n /** Whether to focus the first focusable element on activation. Default `true`. */\n initialFocus?: boolean\n}\n\n/**\n * Constrain Tab / Shift+Tab focus traversal to descendants of `container`.\n *\n * Behavior on activation:\n * - Records the currently focused element.\n * - If `initialFocus !== false`, focuses the first focusable descendant\n * (or the container itself if there are none).\n *\n * Behavior while active:\n * - Tab on the last focusable element wraps to the first; Shift+Tab on\n * the first wraps to the last.\n *\n * Behavior on deactivation:\n * - Restores focus to `returnFocusTo?.current` if provided, else to the\n * element that was focused when the trap activated.\n */\nexport function useFocusTrap(options: UseFocusTrapOptions): void {\n const { container, active, returnFocusTo, initialFocus = true } = options\n const previouslyFocusedRef = React.useRef<HTMLElement | null>(null)\n\n React.useEffect(() => {\n if (!active) return\n if (typeof document === 'undefined') return\n\n previouslyFocusedRef.current = (document.activeElement as HTMLElement | null) ?? null\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Tab') return\n const root = container.current\n if (!root) return\n const focusables = getFocusable(root)\n if (focusables.length === 0) {\n event.preventDefault()\n root.focus()\n return\n }\n const first = focusables[0]!\n const last = focusables[focusables.length - 1]!\n const active = document.activeElement as HTMLElement | null\n\n if (event.shiftKey) {\n if (active === first || !root.contains(active)) {\n event.preventDefault()\n last.focus()\n }\n } else {\n if (active === last || !root.contains(active)) {\n event.preventDefault()\n first.focus()\n }\n }\n }\n document.addEventListener('keydown', onKeyDown)\n\n let raf: number | undefined\n if (initialFocus) {\n raf = requestAnimationFrame(() => {\n const root = container.current\n if (!root) return\n const focusables = getFocusable(root)\n ;(focusables[0] ?? root).focus()\n })\n }\n\n return () => {\n document.removeEventListener('keydown', onKeyDown)\n if (raf !== undefined) cancelAnimationFrame(raf)\n const target = returnFocusTo?.current ?? previouslyFocusedRef.current\n requestAnimationFrame(() => {\n // The element that had focus when the trap opened may have been\n // unmounted while it was open; focusing a detached node silently drops\n // focus to <body>. Only restore if it is still in the document.\n if (target && target.isConnected) target.focus?.()\n })\n previouslyFocusedRef.current = null\n }\n }, [active, container, returnFocusTo, initialFocus])\n}\n"]}
@@ -0,0 +1,43 @@
1
+ import * as React from 'react';
2
+
3
+ /**
4
+ * Lock the document body's scroll while `active` is true. Reference-counted
5
+ * so multiple stacked overlays cooperate. Restores prior `overflow` and
6
+ * `padding-right` (to compensate for the scrollbar gap) when the last lock
7
+ * releases. SSR-safe.
8
+ */
9
+ declare function useBodyScrollLock(active: boolean): void;
10
+ /** Test-only: read the current lock count. */
11
+ declare function __getBodyScrollLockCount(): number;
12
+ /** Test-only: hard-reset the module-level lock state. */
13
+ declare function __resetBodyScrollLock(): void;
14
+
15
+ interface UseFocusTrapOptions {
16
+ /** Element whose Tab key cycle is being trapped. */
17
+ container: React.RefObject<HTMLElement | null>;
18
+ /** Whether the trap is currently active. */
19
+ active: boolean;
20
+ /** Element to restore focus to when the trap deactivates. */
21
+ returnFocusTo?: React.RefObject<HTMLElement | null | undefined>;
22
+ /** Whether to focus the first focusable element on activation. Default `true`. */
23
+ initialFocus?: boolean;
24
+ }
25
+ /**
26
+ * Constrain Tab / Shift+Tab focus traversal to descendants of `container`.
27
+ *
28
+ * Behavior on activation:
29
+ * - Records the currently focused element.
30
+ * - If `initialFocus !== false`, focuses the first focusable descendant
31
+ * (or the container itself if there are none).
32
+ *
33
+ * Behavior while active:
34
+ * - Tab on the last focusable element wraps to the first; Shift+Tab on
35
+ * the first wraps to the last.
36
+ *
37
+ * Behavior on deactivation:
38
+ * - Restores focus to `returnFocusTo?.current` if provided, else to the
39
+ * element that was focused when the trap activated.
40
+ */
41
+ declare function useFocusTrap(options: UseFocusTrapOptions): void;
42
+
43
+ export { type UseFocusTrapOptions, __getBodyScrollLockCount, __resetBodyScrollLock, useBodyScrollLock, useFocusTrap };
@@ -0,0 +1,43 @@
1
+ import * as React from 'react';
2
+
3
+ /**
4
+ * Lock the document body's scroll while `active` is true. Reference-counted
5
+ * so multiple stacked overlays cooperate. Restores prior `overflow` and
6
+ * `padding-right` (to compensate for the scrollbar gap) when the last lock
7
+ * releases. SSR-safe.
8
+ */
9
+ declare function useBodyScrollLock(active: boolean): void;
10
+ /** Test-only: read the current lock count. */
11
+ declare function __getBodyScrollLockCount(): number;
12
+ /** Test-only: hard-reset the module-level lock state. */
13
+ declare function __resetBodyScrollLock(): void;
14
+
15
+ interface UseFocusTrapOptions {
16
+ /** Element whose Tab key cycle is being trapped. */
17
+ container: React.RefObject<HTMLElement | null>;
18
+ /** Whether the trap is currently active. */
19
+ active: boolean;
20
+ /** Element to restore focus to when the trap deactivates. */
21
+ returnFocusTo?: React.RefObject<HTMLElement | null | undefined>;
22
+ /** Whether to focus the first focusable element on activation. Default `true`. */
23
+ initialFocus?: boolean;
24
+ }
25
+ /**
26
+ * Constrain Tab / Shift+Tab focus traversal to descendants of `container`.
27
+ *
28
+ * Behavior on activation:
29
+ * - Records the currently focused element.
30
+ * - If `initialFocus !== false`, focuses the first focusable descendant
31
+ * (or the container itself if there are none).
32
+ *
33
+ * Behavior while active:
34
+ * - Tab on the last focusable element wraps to the first; Shift+Tab on
35
+ * the first wraps to the last.
36
+ *
37
+ * Behavior on deactivation:
38
+ * - Restores focus to `returnFocusTo?.current` if provided, else to the
39
+ * element that was focused when the trap activated.
40
+ */
41
+ declare function useFocusTrap(options: UseFocusTrapOptions): void;
42
+
43
+ export { type UseFocusTrapOptions, __getBodyScrollLockCount, __resetBodyScrollLock, useBodyScrollLock, useFocusTrap };
@@ -0,0 +1,4 @@
1
+ 'use client'
2
+ export { __getBodyScrollLockCount, __resetBodyScrollLock, useBodyScrollLock, useFocusTrap } from './chunk-AUA5GBT6.js';
3
+ //# sourceMappingURL=modal-utils.js.map
4
+ //# sourceMappingURL=modal-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":";","file":"modal-utils.js"}
@@ -0,0 +1,104 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var core = require('@iris-ui-kit/core');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
+
27
+ // src/motion/usePrefersReducedMotion.ts
28
+ var QUERY = "(prefers-reduced-motion: reduce)";
29
+ function read() {
30
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return false;
31
+ return window.matchMedia(QUERY).matches;
32
+ }
33
+ function usePrefersReducedMotion() {
34
+ const [reduced, setReduced] = React__namespace.useState(read);
35
+ React__namespace.useEffect(() => {
36
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
37
+ const mq = window.matchMedia(QUERY);
38
+ const onChange = () => setReduced(mq.matches);
39
+ onChange();
40
+ mq.addEventListener?.("change", onChange);
41
+ return () => mq.removeEventListener?.("change", onChange);
42
+ }, []);
43
+ return reduced;
44
+ }
45
+
46
+ // src/motion/styles.ts
47
+ var __DATA_STATE_STYLE_ID = "iris-data-state-styles";
48
+ var DATA_STATE_CLASS = "iris-data-state-enter";
49
+ var CSS = `
50
+ @keyframes iris-data-state-enter {
51
+ from { opacity: 0; transform: translateY(4px); }
52
+ to { opacity: 1; transform: none; }
53
+ }
54
+ .${DATA_STATE_CLASS} {
55
+ animation: iris-data-state-enter var(--iris-duration-md, 200ms) ease;
56
+ }
57
+ @media (prefers-reduced-motion: reduce) {
58
+ .${DATA_STATE_CLASS} { animation: none; }
59
+ }
60
+ `.trim();
61
+ var installed = false;
62
+ function installDataStateStyles() {
63
+ if (installed) return;
64
+ if (typeof document === "undefined") return;
65
+ if (document.getElementById(__DATA_STATE_STYLE_ID)) {
66
+ installed = true;
67
+ return;
68
+ }
69
+ const el = document.createElement("style");
70
+ el.id = __DATA_STATE_STYLE_ID;
71
+ el.textContent = CSS;
72
+ document.head.appendChild(el);
73
+ installed = true;
74
+ }
75
+ function __resetDataStateStyles() {
76
+ installed = false;
77
+ if (typeof document !== "undefined") {
78
+ document.getElementById(__DATA_STATE_STYLE_ID)?.remove();
79
+ }
80
+ }
81
+
82
+ // src/motion/useDataState.ts
83
+ function useDataState(input) {
84
+ React__namespace.useEffect(installDataStateStyles, []);
85
+ const reduced = usePrefersReducedMotion();
86
+ const state = core.resolveDataState(input);
87
+ return {
88
+ state,
89
+ isContent: state === "content",
90
+ stateKey: state,
91
+ stateProps: {
92
+ className: reduced ? "" : DATA_STATE_CLASS,
93
+ "data-iris-state": state
94
+ }
95
+ };
96
+ }
97
+
98
+ exports.DATA_STATE_CLASS = DATA_STATE_CLASS;
99
+ exports.__resetDataStateStyles = __resetDataStateStyles;
100
+ exports.installDataStateStyles = installDataStateStyles;
101
+ exports.useDataState = useDataState;
102
+ exports.usePrefersReducedMotion = usePrefersReducedMotion;
103
+ //# sourceMappingURL=motion.cjs.map
104
+ //# sourceMappingURL=motion.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/motion/usePrefersReducedMotion.ts","../src/motion/styles.ts","../src/motion/useDataState.ts"],"names":["React","React2","resolveDataState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,KAAA,GAAQ,kCAAA;AAEd,SAAS,IAAA,GAAgB;AACvB,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,MAAA,CAAO,UAAA,KAAe,YAAY,OAAO,KAAA;AACrF,EAAA,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAA,CAAE,OAAA;AAClC;AAOO,SAAS,uBAAA,GAAmC;AACjD,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAUA,0BAAS,IAAI,CAAA;AAEjD,EAAMA,2BAAU,MAAM;AACpB,IAAA,IAAI,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,MAAA,CAAO,eAAe,UAAA,EAAY;AAC9E,IAAA,MAAM,EAAA,GAAK,MAAA,CAAO,UAAA,CAAW,KAAK,CAAA;AAClC,IAAA,MA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BAAA,CAAA,SAAA,CAAU,sBAAA,EAAwB,EAAE,CAAA;AAC1C,EAAA,MAAM,UAAU,uBAAA,EAAwB;AACxC,EAAA,MAAM,KAAA,GAAQC,sBAAiB,KAAK,CAAA;AACpC,EAAA,OAAO;AAAA,IACL,KAAA;AAAA,IACA,WAAW,KAAA,KAAU,SAAA;AAAA,IACrB,QAAA,EAAU,KAAA;AAAA,IACV,UAAA,EAAY;AAAA,MACV,SAAA,EAAW,UAAU,EAAA,GAAK,gBAAA;AAAA,MAC1B,iBAAA,EAAmB;AAAA;AACrB,GACF;AACF","file":"motion.cjs","sourcesContent":["import * as React from 'react'\n\nconst QUERY = '(prefers-reduced-motion: reduce)'\n\nfunction read(): boolean {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return false\n return window.matchMedia(QUERY).matches\n}\n\n/**\n * Reactive `prefers-reduced-motion` flag. Returns `false` where `matchMedia`\n * is unavailable (SSR / older jsdom) so animation is the safe default only when\n * the user has not asked to reduce it.\n */\nexport function usePrefersReducedMotion(): boolean {\n const [reduced, setReduced] = React.useState(read)\n\n React.useEffect(() => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return\n const mq = window.matchMedia(QUERY)\n const onChange = () => setReduced(mq.matches)\n onChange()\n mq.addEventListener?.('change', onChange)\n return () => mq.removeEventListener?.('change', onChange)\n }, [])\n\n return reduced\n}\n","export const __DATA_STATE_STYLE_ID = 'iris-data-state-styles'\n\n/** Class applied to a state node so its entry cross-fades in. */\nexport const DATA_STATE_CLASS = 'iris-data-state-enter'\n\nconst CSS = `\n@keyframes iris-data-state-enter {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: none; }\n}\n.${DATA_STATE_CLASS} {\n animation: iris-data-state-enter var(--iris-duration-md, 200ms) ease;\n}\n@media (prefers-reduced-motion: reduce) {\n .${DATA_STATE_CLASS} { animation: none; }\n}\n`.trim()\n\nlet installed = false\n\n/** Idempotently inject the data-state enter keyframes (SSR-safe no-op). */\nexport function installDataStateStyles(): void {\n if (installed) return\n if (typeof document === 'undefined') return\n if (document.getElementById(__DATA_STATE_STYLE_ID)) {\n installed = true\n return\n }\n const el = document.createElement('style')\n el.id = __DATA_STATE_STYLE_ID\n el.textContent = CSS\n document.head.appendChild(el)\n installed = true\n}\n\nexport function __resetDataStateStyles(): void {\n installed = false\n if (typeof document !== 'undefined') {\n document.getElementById(__DATA_STATE_STYLE_ID)?.remove()\n }\n}\n","import * as React from 'react'\nimport { resolveDataState, type DataState, type DataStateInput } from '@iris-ui-kit/core'\nimport { DATA_STATE_CLASS, installDataStateStyles } from './styles'\nimport { usePrefersReducedMotion } from './usePrefersReducedMotion'\n\nexport interface DataStateNodeProps {\n className: string\n 'data-iris-state': DataState\n}\n\nexport interface UseDataStateReturn {\n /** Resolved state (`error → loading → empty → content` precedence). */\n state: DataState\n /** `true` when the host should render its real content. */\n isContent: boolean\n /** Use as the React `key` of the state node so the enter animation replays on each transition. */\n stateKey: DataState\n /** Spread onto the rendered loading/error/empty node. */\n stateProps: DataStateNodeProps\n}\n\n/**\n * State-transition + entry-animation hook for data components. Resolves the\n * active {@link DataState} from `{ loading, error, empty }`, and returns props\n * for the state node that (a) re-key on every transition so the cross-fade\n * replays and (b) drop the animation class when the user prefers reduced motion.\n *\n * The framework-agnostic precedence lives in `@iris-ui-kit/core`'s\n * {@link resolveDataState}; this hook is the thin React animation bridge.\n */\nexport function useDataState(input: DataStateInput): UseDataStateReturn {\n React.useEffect(installDataStateStyles, [])\n const reduced = usePrefersReducedMotion()\n const state = resolveDataState(input)\n return {\n state,\n isContent: state === 'content',\n stateKey: state,\n stateProps: {\n className: reduced ? '' : DATA_STATE_CLASS,\n 'data-iris-state': state,\n },\n }\n}\n"]}
@@ -0,0 +1,41 @@
1
+ import { DataState, DataStateInput } from '@iris-ui-kit/core';
2
+
3
+ /**
4
+ * Reactive `prefers-reduced-motion` flag. Returns `false` where `matchMedia`
5
+ * is unavailable (SSR / older jsdom) so animation is the safe default only when
6
+ * the user has not asked to reduce it.
7
+ */
8
+ declare function usePrefersReducedMotion(): boolean;
9
+
10
+ interface DataStateNodeProps {
11
+ className: string;
12
+ 'data-iris-state': DataState;
13
+ }
14
+ interface UseDataStateReturn {
15
+ /** Resolved state (`error → loading → empty → content` precedence). */
16
+ state: DataState;
17
+ /** `true` when the host should render its real content. */
18
+ isContent: boolean;
19
+ /** Use as the React `key` of the state node so the enter animation replays on each transition. */
20
+ stateKey: DataState;
21
+ /** Spread onto the rendered loading/error/empty node. */
22
+ stateProps: DataStateNodeProps;
23
+ }
24
+ /**
25
+ * State-transition + entry-animation hook for data components. Resolves the
26
+ * active {@link DataState} from `{ loading, error, empty }`, and returns props
27
+ * for the state node that (a) re-key on every transition so the cross-fade
28
+ * replays and (b) drop the animation class when the user prefers reduced motion.
29
+ *
30
+ * The framework-agnostic precedence lives in `@iris-ui-kit/core`'s
31
+ * {@link resolveDataState}; this hook is the thin React animation bridge.
32
+ */
33
+ declare function useDataState(input: DataStateInput): UseDataStateReturn;
34
+
35
+ /** Class applied to a state node so its entry cross-fades in. */
36
+ declare const DATA_STATE_CLASS = "iris-data-state-enter";
37
+ /** Idempotently inject the data-state enter keyframes (SSR-safe no-op). */
38
+ declare function installDataStateStyles(): void;
39
+ declare function __resetDataStateStyles(): void;
40
+
41
+ export { DATA_STATE_CLASS, type DataStateNodeProps, type UseDataStateReturn, __resetDataStateStyles, installDataStateStyles, useDataState, usePrefersReducedMotion };
@@ -0,0 +1,41 @@
1
+ import { DataState, DataStateInput } from '@iris-ui-kit/core';
2
+
3
+ /**
4
+ * Reactive `prefers-reduced-motion` flag. Returns `false` where `matchMedia`
5
+ * is unavailable (SSR / older jsdom) so animation is the safe default only when
6
+ * the user has not asked to reduce it.
7
+ */
8
+ declare function usePrefersReducedMotion(): boolean;
9
+
10
+ interface DataStateNodeProps {
11
+ className: string;
12
+ 'data-iris-state': DataState;
13
+ }
14
+ interface UseDataStateReturn {
15
+ /** Resolved state (`error → loading → empty → content` precedence). */
16
+ state: DataState;
17
+ /** `true` when the host should render its real content. */
18
+ isContent: boolean;
19
+ /** Use as the React `key` of the state node so the enter animation replays on each transition. */
20
+ stateKey: DataState;
21
+ /** Spread onto the rendered loading/error/empty node. */
22
+ stateProps: DataStateNodeProps;
23
+ }
24
+ /**
25
+ * State-transition + entry-animation hook for data components. Resolves the
26
+ * active {@link DataState} from `{ loading, error, empty }`, and returns props
27
+ * for the state node that (a) re-key on every transition so the cross-fade
28
+ * replays and (b) drop the animation class when the user prefers reduced motion.
29
+ *
30
+ * The framework-agnostic precedence lives in `@iris-ui-kit/core`'s
31
+ * {@link resolveDataState}; this hook is the thin React animation bridge.
32
+ */
33
+ declare function useDataState(input: DataStateInput): UseDataStateReturn;
34
+
35
+ /** Class applied to a state node so its entry cross-fades in. */
36
+ declare const DATA_STATE_CLASS = "iris-data-state-enter";
37
+ /** Idempotently inject the data-state enter keyframes (SSR-safe no-op). */
38
+ declare function installDataStateStyles(): void;
39
+ declare function __resetDataStateStyles(): void;
40
+
41
+ export { DATA_STATE_CLASS, type DataStateNodeProps, type UseDataStateReturn, __resetDataStateStyles, installDataStateStyles, useDataState, usePrefersReducedMotion };
package/dist/motion.js ADDED
@@ -0,0 +1,4 @@
1
+ 'use client'
2
+ export { DATA_STATE_CLASS, __resetDataStateStyles, installDataStateStyles, useDataState, usePrefersReducedMotion } from './chunk-HEJGN6UI.js';
3
+ //# sourceMappingURL=motion.js.map
4
+ //# sourceMappingURL=motion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":";","file":"motion.js"}