@linzjs/windows 10.3.1 → 11.0.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 (223) hide show
  1. package/dist/LuiModalAsync/LuiModalAsync.d.ts +14 -0
  2. package/dist/LuiModalAsync/LuiModalAsync.js +45 -0
  3. package/dist/LuiModalAsync/LuiModalAsync.js.map +1 -0
  4. package/dist/LuiModalAsync/LuiModalAsync.scss +1 -2
  5. package/dist/LuiModalAsync/LuiModalAsyncButtonGroup.d.ts +19 -0
  6. package/dist/LuiModalAsync/LuiModalAsyncButtonGroup.js +27 -0
  7. package/dist/LuiModalAsync/LuiModalAsyncButtonGroup.js.map +1 -0
  8. package/dist/LuiModalAsync/LuiModalAsyncContent.d.ts +6 -0
  9. package/dist/LuiModalAsync/LuiModalAsyncContent.js +7 -0
  10. package/dist/LuiModalAsync/LuiModalAsyncContent.js.map +1 -0
  11. package/dist/LuiModalAsync/LuiModalAsyncContext.d.ts +28 -0
  12. package/dist/LuiModalAsync/LuiModalAsyncContext.js +9 -0
  13. package/dist/LuiModalAsync/LuiModalAsyncContext.js.map +1 -0
  14. package/dist/LuiModalAsync/LuiModalAsyncContextProvider.d.ts +54 -0
  15. package/dist/LuiModalAsync/LuiModalAsyncContextProvider.js +160 -0
  16. package/dist/LuiModalAsync/LuiModalAsyncContextProvider.js.map +1 -0
  17. package/dist/LuiModalAsync/LuiModalAsyncHeader.d.ts +15 -0
  18. package/dist/LuiModalAsync/LuiModalAsyncHeader.js +23 -0
  19. package/dist/LuiModalAsync/LuiModalAsyncHeader.js.map +1 -0
  20. package/dist/LuiModalAsync/LuiModalAsyncInstanceContext.d.ts +13 -0
  21. package/dist/LuiModalAsync/LuiModalAsyncInstanceContext.js +13 -0
  22. package/dist/LuiModalAsync/LuiModalAsyncInstanceContext.js.map +1 -0
  23. package/dist/LuiModalAsync/LuiModalAsyncMain.d.ts +5 -0
  24. package/dist/LuiModalAsync/LuiModalAsyncMain.js +6 -0
  25. package/dist/LuiModalAsync/LuiModalAsyncMain.js.map +1 -0
  26. package/dist/LuiModalAsync/index.js +12 -0
  27. package/dist/LuiModalAsync/index.js.map +1 -0
  28. package/dist/LuiModalAsync/useLuiModalPrefab.d.ts +56 -0
  29. package/dist/LuiModalAsync/useLuiModalPrefab.js +118 -0
  30. package/dist/LuiModalAsync/useLuiModalPrefab.js.map +1 -0
  31. package/dist/LuiModalAsync/useLuiModalUpload.d.ts +16 -0
  32. package/dist/LuiModalAsync/useLuiModalUpload.js +34 -0
  33. package/dist/LuiModalAsync/useLuiModalUpload.js.map +1 -0
  34. package/dist/LuiModalAsync/useShowAsyncModal.d.ts +6 -0
  35. package/dist/LuiModalAsync/useShowAsyncModal.js +13 -0
  36. package/dist/LuiModalAsync/useShowAsyncModal.js.map +1 -0
  37. package/dist/common/debug.d.ts +1 -0
  38. package/dist/common/debug.js +11 -0
  39. package/dist/common/debug.js.map +1 -0
  40. package/dist/common/index.js +3 -0
  41. package/dist/common/index.js.map +1 -0
  42. package/dist/common/useConstFunction.d.ts +5 -0
  43. package/dist/common/useConstFunction.js +17 -0
  44. package/dist/common/useConstFunction.js.map +1 -0
  45. package/dist/common/useInterval.d.ts +17 -0
  46. package/dist/common/{useInterval.ts → useInterval.js} +21 -25
  47. package/dist/common/useInterval.js.map +1 -0
  48. package/dist/common/useIsomorphicLayoutEffect.d.ts +17 -0
  49. package/dist/common/{useIsomorphicLayoutEffect.ts → useIsomorphicLayoutEffect.js} +1 -1
  50. package/dist/common/useIsomorphicLayoutEffect.js.map +1 -0
  51. package/dist/common/util.d.ts +3 -0
  52. package/dist/common/util.js +25 -0
  53. package/dist/common/util.js.map +1 -0
  54. package/dist/common/uuid.d.ts +1 -0
  55. package/dist/common/{uuid.ts → uuid.js} +1 -1
  56. package/dist/common/uuid.js.map +1 -0
  57. package/dist/components/CopyableText.d.ts +9 -0
  58. package/dist/components/CopyableText.js +29 -0
  59. package/dist/components/CopyableText.js.map +1 -0
  60. package/dist/components/index.js +2 -0
  61. package/dist/components/index.js.map +1 -0
  62. package/dist/index.js +7 -0
  63. package/dist/index.js.map +1 -0
  64. package/dist/panel/OpenPanelButton.d.ts +8 -0
  65. package/dist/panel/OpenPanelButton.js +11 -0
  66. package/dist/panel/OpenPanelButton.js.map +1 -0
  67. package/dist/panel/Panel.d.ts +10 -0
  68. package/dist/panel/Panel.js +122 -0
  69. package/dist/panel/Panel.js.map +1 -0
  70. package/dist/panel/PanelContext.d.ts +10 -0
  71. package/dist/panel/PanelContext.js +13 -0
  72. package/dist/panel/PanelContext.js.map +1 -0
  73. package/dist/panel/PanelDock.d.ts +5 -0
  74. package/dist/panel/PanelDock.js +9 -0
  75. package/dist/panel/PanelDock.js.map +1 -0
  76. package/dist/panel/PanelHeader.d.ts +15 -0
  77. package/dist/panel/PanelHeader.js +33 -0
  78. package/dist/panel/PanelHeader.js.map +1 -0
  79. package/dist/panel/PanelHeaderButton.d.ts +8 -0
  80. package/dist/panel/PanelHeaderButton.js +16 -0
  81. package/dist/panel/PanelHeaderButton.js.map +1 -0
  82. package/dist/panel/PanelInline.d.ts +10 -0
  83. package/dist/panel/PanelInline.js +26 -0
  84. package/dist/panel/PanelInline.js.map +1 -0
  85. package/dist/panel/PanelInstanceContext.d.ts +21 -0
  86. package/dist/panel/PanelInstanceContext.js +25 -0
  87. package/dist/panel/PanelInstanceContext.js.map +1 -0
  88. package/dist/panel/PanelInstanceContextProvider.d.ts +11 -0
  89. package/dist/panel/PanelInstanceContextProvider.js +50 -0
  90. package/dist/panel/PanelInstanceContextProvider.js.map +1 -0
  91. package/dist/panel/PanelsContext.d.ts +33 -0
  92. package/dist/panel/PanelsContext.js +19 -0
  93. package/dist/panel/PanelsContext.js.map +1 -0
  94. package/dist/panel/PanelsContextProvider.d.ts +12 -0
  95. package/dist/panel/PanelsContextProvider.js +145 -0
  96. package/dist/panel/PanelsContextProvider.js.map +1 -0
  97. package/dist/panel/PopinWIndow.d.ts +11 -0
  98. package/dist/panel/PopinWIndow.js +74 -0
  99. package/dist/panel/PopinWIndow.js.map +1 -0
  100. package/dist/panel/PopoutWindow.d.ts +17 -0
  101. package/dist/panel/PopoutWindow.js +72 -0
  102. package/dist/panel/PopoutWindow.js.map +1 -0
  103. package/dist/panel/generateId.d.ts +6 -0
  104. package/dist/panel/{generateId.ts → generateId.js} +3 -4
  105. package/dist/panel/generateId.js.map +1 -0
  106. package/dist/panel/handleStyleSheetsChanges.d.ts +9 -0
  107. package/dist/panel/handleStyleSheetsChanges.js +65 -0
  108. package/dist/panel/handleStyleSheetsChanges.js.map +1 -0
  109. package/dist/panel/index.js +13 -0
  110. package/dist/panel/index.js.map +1 -0
  111. package/dist/panel/openExternalWindow.d.ts +23 -0
  112. package/dist/panel/openExternalWindow.js +62 -0
  113. package/dist/panel/openExternalWindow.js.map +1 -0
  114. package/dist/panel/types/{PanelPosition.ts → PanelPosition.d.ts} +2 -2
  115. package/dist/panel/types/PanelPosition.js +2 -0
  116. package/dist/panel/types/PanelPosition.js.map +1 -0
  117. package/dist/panel/types/PanelProps.d.ts +19 -0
  118. package/dist/panel/types/PanelProps.js +2 -0
  119. package/dist/panel/types/PanelProps.js.map +1 -0
  120. package/dist/panel/types/{PanelRestoredState.ts → PanelRestoredState.d.ts} +3 -4
  121. package/dist/panel/types/PanelRestoredState.js +2 -0
  122. package/dist/panel/types/PanelRestoredState.js.map +1 -0
  123. package/dist/panel/types/PanelSize.d.ts +8 -0
  124. package/dist/panel/types/PanelSize.js +2 -0
  125. package/dist/panel/types/PanelSize.js.map +1 -0
  126. package/dist/panel/types/{PanelState.ts → PanelState.d.ts} +5 -8
  127. package/dist/panel/types/PanelState.js +2 -0
  128. package/dist/panel/types/PanelState.js.map +1 -0
  129. package/dist/panel/types/{PanelStateOptions.ts → PanelStateOptions.d.ts} +4 -6
  130. package/dist/panel/types/PanelStateOptions.js +2 -0
  131. package/dist/panel/types/PanelStateOptions.js.map +1 -0
  132. package/dist/panel/types/index.js +7 -0
  133. package/dist/panel/types/index.js.map +1 -0
  134. package/dist/panel/usePanelStateHandler.d.ts +8 -0
  135. package/dist/panel/usePanelStateHandler.js +81 -0
  136. package/dist/panel/usePanelStateHandler.js.map +1 -0
  137. package/dist/ribbon/RibbonButton.d.ts +21 -0
  138. package/dist/ribbon/RibbonButton.js +28 -0
  139. package/dist/ribbon/RibbonButton.js.map +1 -0
  140. package/dist/ribbon/RibbonButtonLink.d.ts +12 -0
  141. package/dist/ribbon/RibbonButtonLink.js +11 -0
  142. package/dist/ribbon/RibbonButtonLink.js.map +1 -0
  143. package/dist/ribbon/RibbonButtonOpenPanel.d.ts +5 -0
  144. package/dist/ribbon/RibbonButtonOpenPanel.js +11 -0
  145. package/dist/ribbon/RibbonButtonOpenPanel.js.map +1 -0
  146. package/dist/ribbon/RibbonButtonSlider.d.ts +11 -0
  147. package/dist/ribbon/RibbonButtonSlider.js +28 -0
  148. package/dist/ribbon/RibbonButtonSlider.js.map +1 -0
  149. package/dist/ribbon/RibbonButtonSliderContext.d.ts +25 -0
  150. package/dist/ribbon/RibbonButtonSliderContext.js +25 -0
  151. package/dist/ribbon/RibbonButtonSliderContext.js.map +1 -0
  152. package/dist/ribbon/RibbonContainer.d.ts +10 -0
  153. package/dist/ribbon/RibbonContainer.js +7 -0
  154. package/dist/ribbon/RibbonContainer.js.map +1 -0
  155. package/dist/ribbon/RibbonDeprecated.d.ts +10 -0
  156. package/dist/ribbon/RibbonDeprecated.js +13 -0
  157. package/dist/ribbon/RibbonDeprecated.js.map +1 -0
  158. package/dist/ribbon/RibbonMenu.d.ts +7 -0
  159. package/dist/ribbon/RibbonMenu.js +12 -0
  160. package/dist/ribbon/RibbonMenu.js.map +1 -0
  161. package/dist/ribbon/RibbonMenuOption.d.ts +17 -0
  162. package/dist/ribbon/RibbonMenuOption.js +26 -0
  163. package/dist/ribbon/RibbonMenuOption.js.map +1 -0
  164. package/dist/ribbon/RibbonMenuSeparator.d.ts +2 -0
  165. package/dist/ribbon/RibbonMenuSeparator.js +6 -0
  166. package/dist/ribbon/RibbonMenuSeparator.js.map +1 -0
  167. package/dist/ribbon/RibbonSeparator.d.ts +2 -0
  168. package/dist/ribbon/RibbonSeparator.js +4 -0
  169. package/dist/ribbon/RibbonSeparator.js.map +1 -0
  170. package/dist/ribbon/index.js +12 -0
  171. package/dist/ribbon/index.js.map +1 -0
  172. package/package.json +14 -8
  173. package/dist/LuiModalAsync/LuiModalAsync.tsx +0 -82
  174. package/dist/LuiModalAsync/LuiModalAsyncButtonGroup.tsx +0 -55
  175. package/dist/LuiModalAsync/LuiModalAsyncContent.tsx +0 -9
  176. package/dist/LuiModalAsync/LuiModalAsyncContext.tsx +0 -52
  177. package/dist/LuiModalAsync/LuiModalAsyncContextProvider.tsx +0 -223
  178. package/dist/LuiModalAsync/LuiModalAsyncHeader.tsx +0 -67
  179. package/dist/LuiModalAsync/LuiModalAsyncInstanceContext.ts +0 -24
  180. package/dist/LuiModalAsync/LuiModalAsyncMain.tsx +0 -8
  181. package/dist/LuiModalAsync/useLuiModalPrefab.tsx +0 -227
  182. package/dist/LuiModalAsync/useLuiModalUpload.tsx +0 -79
  183. package/dist/LuiModalAsync/useShowAsyncModal.ts +0 -34
  184. package/dist/common/debug.ts +0 -9
  185. package/dist/common/useConstFunction.ts +0 -22
  186. package/dist/common/util.ts +0 -31
  187. package/dist/components/CopyableText.tsx +0 -58
  188. package/dist/panel/OpenPanelButton.tsx +0 -52
  189. package/dist/panel/Panel.tsx +0 -211
  190. package/dist/panel/PanelContext.ts +0 -22
  191. package/dist/panel/PanelDock.tsx +0 -20
  192. package/dist/panel/PanelHeader.tsx +0 -105
  193. package/dist/panel/PanelHeaderButton.tsx +0 -26
  194. package/dist/panel/PanelInline.tsx +0 -46
  195. package/dist/panel/PanelInstanceContext.ts +0 -44
  196. package/dist/panel/PanelInstanceContextProvider.tsx +0 -75
  197. package/dist/panel/PanelsContext.tsx +0 -56
  198. package/dist/panel/PanelsContextProvider.tsx +0 -220
  199. package/dist/panel/PopinWIndow.tsx +0 -147
  200. package/dist/panel/PopoutWindow.tsx +0 -117
  201. package/dist/panel/handleStyleSheetsChanges.ts +0 -71
  202. package/dist/panel/openExternalWindow.ts +0 -98
  203. package/dist/panel/types/PanelProps.ts +0 -22
  204. package/dist/panel/types/PanelSize.ts +0 -9
  205. package/dist/panel/usePanelStateHandler.tsx +0 -102
  206. package/dist/ribbon/RibbonButton.tsx +0 -112
  207. package/dist/ribbon/RibbonButtonLink.tsx +0 -27
  208. package/dist/ribbon/RibbonButtonOpenPanel.tsx +0 -23
  209. package/dist/ribbon/RibbonButtonSlider.tsx +0 -66
  210. package/dist/ribbon/RibbonButtonSliderContext.tsx +0 -34
  211. package/dist/ribbon/RibbonContainer.tsx +0 -19
  212. package/dist/ribbon/RibbonDeprecated.tsx +0 -27
  213. package/dist/ribbon/RibbonMenu.tsx +0 -25
  214. package/dist/ribbon/RibbonMenuOption.tsx +0 -67
  215. package/dist/ribbon/RibbonMenuSeparator.tsx +0 -5
  216. package/dist/ribbon/RibbonSeparator.tsx +0 -3
  217. /package/dist/LuiModalAsync/{index.ts → index.d.ts} +0 -0
  218. /package/dist/common/{index.ts → index.d.ts} +0 -0
  219. /package/dist/components/{index.ts → index.d.ts} +0 -0
  220. /package/dist/{index.ts → index.d.ts} +0 -0
  221. /package/dist/panel/{index.ts → index.d.ts} +0 -0
  222. /package/dist/panel/types/{index.ts → index.d.ts} +0 -0
  223. /package/dist/ribbon/{index.ts → index.d.ts} +0 -0
@@ -0,0 +1,118 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { LuiButton, LuiCheckboxInput, LuiIcon, LuiMiniSpinner } from '@linzjs/lui';
3
+ import clsx from 'clsx';
4
+ import { flatMap, omit, pick } from 'lodash-es';
5
+ import { useCallback, useMemo, useState } from 'react';
6
+ import { debugLog } from '../common/debug';
7
+ import { LuiModalAsync } from './LuiModalAsync';
8
+ import { LuiModalAsyncButtonGroup } from './LuiModalAsyncButtonGroup';
9
+ import { LuiModalAsyncContent } from './LuiModalAsyncContent';
10
+ import { LuiModalAsyncHeader } from './LuiModalAsyncHeader';
11
+ import { LuiModalAsyncMain } from './LuiModalAsyncMain';
12
+ import { useShowAsyncModal } from './useShowAsyncModal';
13
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
14
+ export const getIconForLevel = (level) => {
15
+ switch (level) {
16
+ case 'success':
17
+ return 'ic_check_circle_outline';
18
+ case 'info':
19
+ return 'ic_info_outline';
20
+ case 'warning':
21
+ return 'ic_warning_outline';
22
+ case 'error':
23
+ return 'ic_error_outline';
24
+ case 'progress':
25
+ return 'custom_progress';
26
+ case 'blocked':
27
+ return 'ic_lock_alt';
28
+ case 'outline':
29
+ return null;
30
+ }
31
+ };
32
+ const LuiModalDontShowSessionStorageKey = (userKey) => `__LuiModalContext_dontshowagain_${userKey}`;
33
+ export const LuiModalDontShowSessionSet = (userKey) => window.sessionStorage.setItem(LuiModalDontShowSessionStorageKey(userKey), 'true');
34
+ export const LuiModalDontShowSessionRemove = (userKey) => window.sessionStorage.removeItem(LuiModalDontShowSessionStorageKey(userKey));
35
+ export const LuiModalDontShowSessionCheck = (userKey) => !!window.sessionStorage.getItem(LuiModalDontShowSessionStorageKey(userKey));
36
+ /**
37
+ * A generic template for common types of modals.
38
+ */
39
+ export const LuiModalPrefab = (props) => {
40
+ const { level = 'warning', className, style, title, helpLink, onHelpClick, children, resolve, closeOnOverlayClick, dontShowAgainSessionKey, } = props;
41
+ const [dontShowAgain, setDontShowAgain] = useState(false);
42
+ const icon = getIconForLevel(level);
43
+ /**
44
+ * Default buttons
45
+ * Warning, Info, Error, Success: "Dismiss"
46
+ * Progress: "Cancel"
47
+ */
48
+ const buttons = props.buttons ?? [
49
+ {
50
+ title: level === 'progress' ? 'Cancel' : 'Dismiss',
51
+ },
52
+ ];
53
+ // If there are two options, option 1 is secondary, option 2 is primary
54
+ // Otherwise all options are secondary
55
+ if (buttons.length === 2) {
56
+ buttons.forEach((b, i) => {
57
+ if (!b.level) {
58
+ // Last button is primary all others are secondary
59
+ b.level = i === buttons.length - 1 ? 'primary' : 'secondary';
60
+ }
61
+ });
62
+ }
63
+ /**
64
+ * When dialog closes save the "don't show" property
65
+ */
66
+ const setDontShow = () => {
67
+ if (dontShowAgainSessionKey && dontShowAgain) {
68
+ LuiModalDontShowSessionSet(dontShowAgainSessionKey);
69
+ }
70
+ };
71
+ return (_jsxs(LuiModalAsync, { className: clsx('LuiModalPrefab', `LuiModalPrefab-${level}`, className), style: style, closeOnOverlayClick: closeOnOverlayClick, children: [_jsxs(LuiModalAsyncMain, { children: [_jsx(LuiModalAsyncHeader, { title: title, icon: icon === 'custom_progress' ? _jsx(LuiMiniSpinner, { size: 24 }) : icon, helpLink: helpLink, onHelpClick: onHelpClick }), _jsx(LuiModalAsyncContent, { children: children }), dontShowAgainSessionKey && (_jsx(LuiCheckboxInput, { className: 'LuiCheckboxInput--nomargin', label: "Don't show me this again", value: 'dontShowAgain', isChecked: dontShowAgain, onChange: (e) => setDontShowAgain(e.target.checked) }))] }), _jsx(LuiModalAsyncButtonGroup, { children: buttons.map((pf, i) => (_jsxs(LuiButton, { level: pf.level === 'secondary-error' ? 'secondary' : (pf.level ?? 'secondary'), className: clsx(pf.icon && 'lui-button-icon', pf.level === 'secondary-error' && 'lui-button-secondary-error'), onClick: () => {
72
+ setDontShow();
73
+ resolve(pf.value);
74
+ }, buttonProps: pf.default ? { 'data-autofocus': true } : undefined, children: [pf.icon && _jsx(LuiIcon, { name: pf.icon, alt: pf.title, size: 'md' }), pf.title] }, i))) })] }));
75
+ };
76
+ /**
77
+ * Instantiate a generic template for common types of modals.
78
+ *
79
+ * Usage:
80
+ * const { modalOwnerRef, showPrefabModal } = useLuiModalPrefab();
81
+ *
82
+ * return (
83
+ * <button
84
+ * ref={modalOwnerRef}
85
+ * onClick={() =>
86
+ * showPrefabModal({
87
+ * level: 'info',
88
+ * title: 'You are a fantastic person',
89
+ * children: 'Keep it up!',
90
+ * })
91
+ * }>
92
+ * Open Modal
93
+ * </button>
94
+ */
95
+ export const useLuiModalPrefab = () => {
96
+ const { showModal, modalOwnerRef } = useShowAsyncModal();
97
+ const showPrefabModal = useCallback((props) => {
98
+ debugLog(`Show '${props.level}' prefab-modal '${props.title}'`, props);
99
+ if (typeof props.children === 'string') {
100
+ // Convert \n to <br/>
101
+ const split = props.children.split('\n');
102
+ props.children = flatMap(split.map((part, i) => (i !== split.length - 1 ? [part, _jsx("br", {}, i)] : part)));
103
+ }
104
+ if ((props.dontShowAgainSessionKey && LuiModalDontShowSessionCheck(props.dontShowAgainSessionKey)) ||
105
+ (props.polledCloseCondition && props.polledCloseCondition())) {
106
+ // Add resolve method to make the signature of showPrefabModal consistent
107
+ const prom = Promise.resolve(undefined);
108
+ prom.resolve = (_val) => { };
109
+ return prom;
110
+ }
111
+ return showModal(LuiModalPrefab, omit(props, ['showOnAllWindows', 'polledCloseCondition']), pick(props, ['showOnAllWindows', 'polledCloseCondition']));
112
+ }, [showModal]);
113
+ return useMemo(() => ({
114
+ modalOwnerRef,
115
+ showPrefabModal,
116
+ }), [modalOwnerRef, showPrefabModal]);
117
+ };
118
+ //# sourceMappingURL=useLuiModalPrefab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLuiModalPrefab.js","sourceRoot":"","sources":["../../src/LuiModalAsync/useLuiModalPrefab.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGnF,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAmC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExF,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAsB,MAAM,iBAAiB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AC,OAAO,GAAG,CAAC,IAAoB,EAAE,EAAE,GAAE,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,SAAS,CACd,cAAc,EACd,IAAI,CAAC,KAAK,EAAE,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAAC,EACzD,IAAI,CAAC,KAAK,EAAE,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAAC,CAChC,CAAC;IAC9B,CAAC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,aAAa;QACb,eAAe;KAChB,CAAC,EACF,CAAC,aAAa,EAAE,eAAe,CAAC,CACjC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { LuiFileInputBoxProps } from '@linzjs/lui/dist/components/LuiFormElements/LuiFileInputBox/LuiFileInputBox';
2
+ import { ReactElement } from 'react';
3
+ import { LuiModalAsyncCallback, PromiseWithResolve } from './LuiModalAsyncContext';
4
+ export interface useLuiModalUploadProps extends Omit<LuiFileInputBoxProps, 'onValidFileSelected'> {
5
+ title?: string;
6
+ content?: ReactElement | string;
7
+ validateFile?: (file: File) => string;
8
+ }
9
+ /**
10
+ * A generic template for common types of modals.
11
+ */
12
+ export declare const LuiModalUpload: ({ validateFile, resolve, title, width, height, content, ...props }: useLuiModalUploadProps & LuiModalAsyncCallback<File>) => ReactElement;
13
+ export declare const useLuiModalUpload: () => {
14
+ modalOwnerRef: import("react").MutableRefObject<any>;
15
+ showUploadModal: (props: useLuiModalUploadProps) => PromiseWithResolve<File>;
16
+ };
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { LuiFileInputBox } from '@linzjs/lui';
3
+ import clsx from 'clsx';
4
+ import { useCallback, useMemo, useState } from 'react';
5
+ import { LuiModalAsync } from './LuiModalAsync';
6
+ import { LuiModalAsyncHeader } from './LuiModalAsyncHeader';
7
+ import { useShowAsyncModal } from './useShowAsyncModal';
8
+ /**
9
+ * A generic template for common types of modals.
10
+ */
11
+ export const LuiModalUpload = ({ validateFile, resolve, title, width, height, content, ...props }) => {
12
+ const [errorMessage, setErrorMessage] = useState(undefined);
13
+ const uploadFile = useCallback((file) => {
14
+ const error = validateFile?.(file);
15
+ if (error) {
16
+ setErrorMessage(error);
17
+ }
18
+ else {
19
+ resolve(file);
20
+ }
21
+ }, [resolve, validateFile]);
22
+ return (_jsxs(LuiModalAsync, { className: clsx('LuiModalPrefab', `LuiModalPrefab-file`), closeOnOverlayClick: true, style: { width: width ?? 512, minHeight: height, height: height }, children: [title && _jsx(LuiModalAsyncHeader, { title: title ?? 'Upload file...', closeButton: true }), content, _jsx(LuiFileInputBox, { ...props, width: '100%', showMustSelectFileError: !!errorMessage, customFileErrorMessage: errorMessage ?? props.customFileErrorMessage, onValidFileSelected: uploadFile })] }));
23
+ };
24
+ export const useLuiModalUpload = () => {
25
+ const { showModal, modalOwnerRef } = useShowAsyncModal();
26
+ const showUploadModal = useCallback((props) => {
27
+ return showModal(LuiModalUpload, props);
28
+ }, [showModal]);
29
+ return useMemo(() => ({
30
+ modalOwnerRef,
31
+ showUploadModal,
32
+ }), [modalOwnerRef, showUploadModal]);
33
+ };
34
+ //# sourceMappingURL=useLuiModalUpload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLuiModalUpload.js","sourceRoot":"","sources":["../../src/LuiModalAsync/useLuiModalUpload.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAgB,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAi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E,CAAC;IAEzD,MAAM,eAAe,GAAG,WAAW,CACjC,CAAC,KAA6B,EAA4B,EAAE;QAC1D,OAAO,SAAS,CAAC,cAAc,EAAE,KAAK,CAA6B,CAAC;IACtE,CAAC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,aAAa;QACb,eAAe;KAChB,CAAC,EACF,CAAC,aAAa,EAAE,eAAe,CAAC,CACjC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ComponentProps } from 'react';
2
+ import { ComponentType, PromiseWithResolve, ShowModalProps } from './LuiModalAsyncContext';
3
+ export declare const useShowAsyncModal: () => {
4
+ showModal: <CT extends ComponentType>(component: CT, args: Omit<ComponentProps<CT>, "resolve" | "close">, props?: ShowModalProps) => PromiseWithResolve<Parameters<ComponentProps<CT>["resolve"]>[0]>;
5
+ modalOwnerRef: import("react").MutableRefObject<any>;
6
+ };
@@ -0,0 +1,13 @@
1
+ import { useCallback, useContext, useMemo, useRef } from 'react';
2
+ import { LuiModalAsyncContext, openModalOnAllWindows, } from './LuiModalAsyncContext';
3
+ export const useShowAsyncModal = () => {
4
+ const { showModal } = useContext(LuiModalAsyncContext);
5
+ // eslint-disable-next-line
6
+ const modalOwnerRef = useRef(document.body);
7
+ const showModalAsync = useCallback((component, args, props) => showModal(props?.showOnAllWindows ? openModalOnAllWindows : modalOwnerRef, component, args, props), [showModal]);
8
+ return useMemo(() => ({
9
+ showModal: showModalAsync,
10
+ modalOwnerRef,
11
+ }), [showModalAsync]);
12
+ };
13
+ //# sourceMappingURL=useShowAsyncModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useShowAsyncModal.js","sourceRoot":"","sources":["../../src/LuiModalAsync/useShowAsyncModal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAEL,oBAAoB,EACpB,qBAAqB,GAGtB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAEvD,2BAA2B;IAC3B,MAAM,aAAa,GAAG,MAAM,CAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEjD,MAAM,cAAc,GAAG,WAAW,CAChC,CACE,SAAa,EACb,IAAmD,EACnD,KAAsB,EAC4C,EAAE,CACpE,SAAS,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,EACpG,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,SAAS,EAAE,cAAc;QACzB,aAAa;KACd,CAAC,EACF,CAAC,cAAc,CAAC,CACjB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const debugLog: (message: string, obj: unknown) => void;
@@ -0,0 +1,11 @@
1
+ export const debugLog = (message, obj) => {
2
+ try {
3
+ if (localStorage.getItem('@linzjs/windows.debugEnabled') == 'true') {
4
+ console.debug(`@linzjs/windows: ${message}`, obj);
5
+ }
6
+ }
7
+ catch (e) {
8
+ console.error(e);
9
+ }
10
+ };
11
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/common/debug.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,GAAY,EAAE,EAAE;IACxD,IAAI,CAAC;QACH,IAAI,YAAY,CAAC,OAAO,CAAC,8BAA8B,CAAC,IAAI,MAAM,EAAE,CAAC;YACnE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './useConstFunction';
2
+ export * from './util';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * When calling external non-react components, and you can't update the function when state changes,
3
+ * use this to proxy the dynamic function with a static function.
4
+ */
5
+ export declare const useConstFunction: <Args extends never[], R, TFn extends ((...args: Args) => R) | null | undefined>(fn?: TFn) => TFn;
@@ -0,0 +1,17 @@
1
+ import { useEffect, useRef } from 'react';
2
+ const VoidFn = () => {
3
+ // empty
4
+ };
5
+ /**
6
+ * When calling external non-react components, and you can't update the function when state changes,
7
+ * use this to proxy the dynamic function with a static function.
8
+ */
9
+ export const useConstFunction = (fn = VoidFn) => {
10
+ const functionRef = useRef(fn);
11
+ const proxyRef = useRef(((...args) => functionRef.current?.(...args)));
12
+ useEffect(() => {
13
+ functionRef.current = fn;
14
+ }, [fn]);
15
+ return proxyRef.current;
16
+ };
17
+ //# sourceMappingURL=useConstFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConstFunction.js","sourceRoot":"","sources":["../../src/common/useConstFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,MAAM,GAAG,GAAG,EAAE;IAClB,QAAQ;AACV,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,KAAU,MAAa,EAClB,EAAE;IACP,MAAM,WAAW,GAAG,MAAM,CAAM,EAAE,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,MAAM,CAAM,CAAC,CAAC,GAAG,IAAU,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAQ,CAAC,CAAC;IAEzF,SAAS,CAAC,GAAG,EAAE;QACb,WAAW,CAAC,OAAO,GAAG,EAAE,CAAC;IAC3B,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAET,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copied from usehooks-ts
3
+ *
4
+ * Custom hook that creates an interval that invokes a callback function at a specified delay using the [`setInterval API`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval).
5
+ * @param {() => void} callback - The function to be invoked at each interval.
6
+ * @param {number | null} delay - The time, in milliseconds, between each invocation of the callback. Use `null` to clear the interval.
7
+ * @public
8
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-interval)
9
+ * @example
10
+ * ```tsx
11
+ * const handleInterval = () => {
12
+ * // Code to be executed at each interval
13
+ * };
14
+ * useInterval(handleInterval, 1000);
15
+ * ```
16
+ */
17
+ export declare function useInterval(callback: () => void, delay: number | null): void;
@@ -1,6 +1,5 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
  import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
3
-
4
3
  /**
5
4
  * Copied from usehooks-ts
6
5
  *
@@ -17,28 +16,25 @@ import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
17
16
  * useInterval(handleInterval, 1000);
18
17
  * ```
19
18
  */
20
- export function useInterval(callback: () => void, delay: number | null) {
21
- const savedCallback = useRef(callback);
22
-
23
- // Remember the latest callback if it changes.
24
- useIsomorphicLayoutEffect(() => {
25
- savedCallback.current = callback;
26
- }, [callback]);
27
-
28
- // Set up the interval.
29
- useEffect(() => {
30
- // Don't schedule if no delay is specified.
31
- // Note: 0 is a valid value for delay.
32
- if (delay === null) {
33
- return;
34
- }
35
-
36
- const id = setInterval(() => {
37
- savedCallback.current();
38
- }, delay);
39
-
40
- return () => {
41
- clearInterval(id);
42
- };
43
- }, [delay]);
19
+ export function useInterval(callback, delay) {
20
+ const savedCallback = useRef(callback);
21
+ // Remember the latest callback if it changes.
22
+ useIsomorphicLayoutEffect(() => {
23
+ savedCallback.current = callback;
24
+ }, [callback]);
25
+ // Set up the interval.
26
+ useEffect(() => {
27
+ // Don't schedule if no delay is specified.
28
+ // Note: 0 is a valid value for delay.
29
+ if (delay === null) {
30
+ return;
31
+ }
32
+ const id = setInterval(() => {
33
+ savedCallback.current();
34
+ }, delay);
35
+ return () => {
36
+ clearInterval(id);
37
+ };
38
+ }, [delay]);
44
39
  }
40
+ //# sourceMappingURL=useInterval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInterval.js","sourceRoot":"","sources":["../../src/common/useInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,WAAW,CAAC,QAAoB,EAAE,KAAoB;IACpE,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEvC,8CAA8C;IAC9C,yBAAyB,CAAC,GAAG,EAAE;QAC7B,aAAa,CAAC,OAAO,GAAG,QAAQ,CAAC;IACnC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,uBAAuB;IACvB,SAAS,CAAC,GAAG,EAAE;QACb,2CAA2C;QAC3C,sCAAsC;QACtC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE;YAC1B,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC,EAAE,KAAK,CAAC,CAAC;QAEV,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { useEffect } from 'react';
2
+ /**
3
+ * Copied from usehooks-ts
4
+ *
5
+ * Custom hook that uses either `useLayoutEffect` or `useEffect` based on the environment (client-side or server-side).
6
+ * @param {Function} effect - The effect function to be executed.
7
+ * @param {Array<any>} [dependencies] - An array of dependencies for the effect (optional).
8
+ * @public
9
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect)
10
+ * @example
11
+ * ```tsx
12
+ * useIsomorphicLayoutEffect(() => {
13
+ * // Code to be executed during the layout phase on the client side
14
+ * }, [dependency1, dependency2]);
15
+ * ```
16
+ */
17
+ export declare const useIsomorphicLayoutEffect: typeof useEffect;
@@ -1,5 +1,4 @@
1
1
  import { useEffect, useLayoutEffect } from 'react';
2
-
3
2
  /**
4
3
  * Copied from usehooks-ts
5
4
  *
@@ -16,3 +15,4 @@ import { useEffect, useLayoutEffect } from 'react';
16
15
  * ```
17
16
  */
18
17
  export const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
18
+ //# sourceMappingURL=useIsomorphicLayoutEffect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsomorphicLayoutEffect.js","sourceRoot":"","sources":["../../src/common/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const tabToNextSiblingElement: () => void;
2
+ export declare const tabToPreviousSiblingElement: () => void;
3
+ export declare const tabToSiblingElement: (direction: 1 | -1) => void;
@@ -0,0 +1,25 @@
1
+ export const tabToNextSiblingElement = () => tabToSiblingElement(1);
2
+ export const tabToPreviousSiblingElement = () => tabToSiblingElement(-1);
3
+ export const tabToSiblingElement = (direction) => {
4
+ const active = document.activeElement;
5
+ if (!active) {
6
+ return;
7
+ }
8
+ const selector = [
9
+ 'a[href]',
10
+ 'area[href]',
11
+ 'button:not([disabled])',
12
+ 'input:not([disabled]):not([type="hidden"])',
13
+ 'select:not([disabled])',
14
+ 'textarea:not([disabled])',
15
+ 'iframe',
16
+ '[tabindex]:not([tabindex="-1"])',
17
+ '[contenteditable="true"]',
18
+ ].join(',');
19
+ const focusables = Array.from(active.parentElement?.querySelectorAll(selector) ?? []).filter((el) => el.offsetParent !== null && getComputedStyle(el).visibility !== 'hidden');
20
+ const next = focusables.indexOf(active) + direction;
21
+ if (next >= 0 && next < focusables.length) {
22
+ focusables[next]?.focus();
23
+ }
24
+ };
25
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/common/util.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAS,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAS,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAiB,EAAQ,EAAE;IAC7D,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAmC,CAAC;IAC5D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG;QACf,SAAS;QACT,YAAY;QACZ,wBAAwB;QACxB,4CAA4C;QAC5C,wBAAwB;QACxB,0BAA0B;QAC1B,QAAQ;QACR,iCAAiC;QACjC,0BAA0B;KAC3B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEZ,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAc,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CACvG,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,YAAY,KAAK,IAAI,IAAI,gBAAgB,CAAC,EAAE,CAAC,CAAC,UAAU,KAAK,QAAQ,CACjF,CAAC;IAEF,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAEpD,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;QAC1C,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const v4: () => string;
@@ -1,4 +1,4 @@
1
1
  let counter = 0;
2
-
3
2
  // We don't need a uuid a simple number would suffice
4
3
  export const v4 = () => `__windowsId__${counter++}`;
4
+ //# sourceMappingURL=uuid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src/common/uuid.ts"],"names":[],"mappings":"AAAA,IAAI,OAAO,GAAG,CAAC,CAAC;AAEhB,qDAAqD;AACrD,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE,CAAC,gBAAgB,OAAO,EAAE,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import '../index.scss';
2
+ import { CSSProperties, ReactElement } from 'react';
3
+ export interface CopyableTextProps {
4
+ dataTestId?: string;
5
+ style?: CSSProperties;
6
+ className?: string;
7
+ text: string | number;
8
+ }
9
+ export declare const CopyableText: (props: CopyableTextProps) => ReactElement;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import '../index.scss';
3
+ import clsx from 'clsx';
4
+ import { useEffect, useRef, useState } from 'react';
5
+ export const CopyableText = (props) => {
6
+ const [copied, setCopied] = useState(false);
7
+ const { dataTestId, style, className, text } = props;
8
+ const timeoutRefDisplay = useRef(null);
9
+ const copy = (event) => {
10
+ const win = event.currentTarget.ownerDocument.defaultView ?? window;
11
+ win.navigator.clipboard.writeText(String(text)).then(() => {
12
+ setCopied(true);
13
+ timeoutRefDisplay.current = setTimeout(() => void setCopied(false), 3000);
14
+ }, (err) => {
15
+ alert(`Data copy failed: ${err.message}`);
16
+ });
17
+ };
18
+ useEffect(() => () => {
19
+ if (timeoutRefDisplay.current) {
20
+ clearTimeout(timeoutRefDisplay.current);
21
+ timeoutRefDisplay.current = null;
22
+ }
23
+ }, []);
24
+ return (_jsxs("span", { "data-testid": dataTestId, style: style, className: clsx('windows_tooltip', className), onClick: (event) => {
25
+ event.stopPropagation();
26
+ copy(event);
27
+ }, children: [_jsx("span", { className: "windows_tooltiptext", style: { width: copied ? '62px' : '47px' }, children: copied ? 'Copied!' : 'Copy' }), text] }));
28
+ };
29
+ //# sourceMappingURL=CopyableText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyableText.js","sourceRoot":"","sources":["../../src/components/CopyableText.tsx"],"names":[],"mappings":";AAAA,OAAO,eAAe,CAAC;AAEvB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAA2C,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAS7F,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAwB,EAAgB,EAAE;IACrE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,iBAAiB,GAAG,MAAM,CAAuC,IAAI,CAAC,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R,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './CopyableText';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export * from './common';
2
+ export * from './components';
3
+ export * from './LuiModalAsync';
4
+ export * from './panel';
5
+ export * from './panel/types';
6
+ export * from './ribbon';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { OpenPanelOptions } from './PanelsContext';
2
+ interface OpenPanelButtonProps extends OpenPanelOptions {
3
+ uniqueId?: string;
4
+ testId?: string;
5
+ buttonText: string;
6
+ }
7
+ export declare const OpenPanelButton: ({ buttonText, testId, uniqueId, ...openPanelOptions }: OpenPanelButtonProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ // Simple button to open panel and show panel state
3
+ import { useContext } from 'react';
4
+ import { PanelsContext } from './PanelsContext';
5
+ export const OpenPanelButton = ({ buttonText, testId, uniqueId = buttonText, ...openPanelOptions }) => {
6
+ const { openPanel, closePanel, hidePanel, unhidePanel, hasOpenPanel, hasHiddenPanel } = useContext(PanelsContext);
7
+ const open = hasOpenPanel(uniqueId);
8
+ const hidden = hasHiddenPanel(uniqueId);
9
+ return (_jsxs("div", { children: [_jsxs("b", { children: [buttonText, " ", open ? '(Open)' : ''] }), _jsx("br", {}), !open && (_jsx("button", { "data-testid": testId + 'Open', onClick: () => openPanel({ uniqueId, ...openPanelOptions }), children: "Open" })), open && (_jsxs(_Fragment, { children: [_jsx("button", { "data-testid": testId + 'Close', onClick: () => closePanel(uniqueId), children: "Close" }), hidden ? (_jsx("button", { "data-testid": testId + 'Unhide', onClick: () => unhidePanel(uniqueId), children: "Unhide" })) : (_jsx("button", { "data-testid": testId + 'Hide', onClick: () => hidePanel(uniqueId), children: "Hide" }))] }))] }));
10
+ };
11
+ //# sourceMappingURL=OpenPanelButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenPanelButton.js","sourceRoot":"","sources":["../../src/panel/OpenPanelButton.tsx"],"names":[],"mappings":";AAAA,mDAAmD;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAoB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQlE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,UAAU,EACV,MAAM,EACN,QAAQ,GAAG,UAAU,EACrB,GAAG,gBAAgB,EACE,EAAE,EAAE;IACzB,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAElH,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IACxC,OAAO,CACL,0BACE,wBACG,UAAU,OAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAChC,EACJ,cAAM,EAEL,CAAC,IAAI,IAAI,CACR,gCAAqB,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAG,gBAAgB,EAAE,CAAC,qBAExF,CACV,EACA,IAAI,IAAI,CACP,8BACE,gCAAqB,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,sBAEjE,EACR,MAAM,CAAC,CAAC,CAAC,CACR,gCAAqB,MAAM,GAAG,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,uBAEnE,CACV,CAAC,CAAC,CAAC,CACF,gCAAqB,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,qBAE/D,CACV,IACA,CACJ,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import '../index.scss';
2
+ import { ReactElement } from 'react';
3
+ import { PanelProps } from './types/PanelProps';
4
+ export declare const Panel: (props: PanelProps) => ReactElement;
5
+ export interface PanelContentProps {
6
+ className?: string | undefined;
7
+ }
8
+ export declare const PanelContent: import("react").ForwardRefExoticComponent<PanelContentProps & {
9
+ children?: import("react").ReactNode | undefined;
10
+ } & import("react").RefAttributes<HTMLDivElement>>;