@admin-layout/tailwind-ui 10.0.9-alpha.71

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 (129) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +297 -0
  3. package/lib/components/ErrorHandlers/ApplicationErrorHandler.d.ts +2 -0
  4. package/lib/components/ErrorHandlers/ApplicationErrorHandler.d.ts.map +1 -0
  5. package/lib/components/ErrorHandlers/ApplicationErrorHandler.js +24 -0
  6. package/lib/components/ErrorHandlers/ApplicationErrorHandler.js.map +1 -0
  7. package/lib/components/ErrorHandlers/ErrorBoundary.d.ts +2 -0
  8. package/lib/components/ErrorHandlers/ErrorBoundary.d.ts.map +1 -0
  9. package/lib/components/ErrorHandlers/ErrorBoundary.js +48 -0
  10. package/lib/components/ErrorHandlers/ErrorBoundary.js.map +1 -0
  11. package/lib/components/ErrorHandlers/LayoutErrorBoundary.d.ts +2 -0
  12. package/lib/components/ErrorHandlers/LayoutErrorBoundary.d.ts.map +1 -0
  13. package/lib/components/ErrorHandlers/LayoutErrorBoundary.js +34 -0
  14. package/lib/components/ErrorHandlers/LayoutErrorBoundary.js.map +1 -0
  15. package/lib/components/ErrorHandlers/index.d.ts +4 -0
  16. package/lib/components/ErrorHandlers/index.d.ts.map +1 -0
  17. package/lib/components/ErrorPages/403.d.ts +2 -0
  18. package/lib/components/ErrorPages/403.d.ts.map +1 -0
  19. package/lib/components/ErrorPages/403.js +29 -0
  20. package/lib/components/ErrorPages/403.js.map +1 -0
  21. package/lib/components/ErrorPages/404.d.ts +2 -0
  22. package/lib/components/ErrorPages/404.d.ts.map +1 -0
  23. package/lib/components/ErrorPages/404.js +29 -0
  24. package/lib/components/ErrorPages/404.js.map +1 -0
  25. package/lib/components/ErrorPages/500.d.ts +2 -0
  26. package/lib/components/ErrorPages/500.d.ts.map +1 -0
  27. package/lib/components/ErrorPages/500.js +29 -0
  28. package/lib/components/ErrorPages/500.js.map +1 -0
  29. package/lib/components/ErrorPages/index.d.ts +4 -0
  30. package/lib/components/ErrorPages/index.d.ts.map +1 -0
  31. package/lib/components/OTP/OTPInput.d.ts +4 -0
  32. package/lib/components/OTP/OTPInput.d.ts.map +1 -0
  33. package/lib/components/OTP/OTPInput.js +82 -0
  34. package/lib/components/OTP/OTPInput.js.map +1 -0
  35. package/lib/components/OTP/OTPVerification.d.ts +4 -0
  36. package/lib/components/OTP/OTPVerification.d.ts.map +1 -0
  37. package/lib/components/OTP/OTPVerification.js +155 -0
  38. package/lib/components/OTP/OTPVerification.js.map +1 -0
  39. package/lib/components/OTP/SingleInput.d.ts +10 -0
  40. package/lib/components/OTP/SingleInput.d.ts.map +1 -0
  41. package/lib/components/OTP/SingleInput.js +43 -0
  42. package/lib/components/OTP/SingleInput.js.map +1 -0
  43. package/lib/components/OTP/hooks.d.ts +3 -0
  44. package/lib/components/OTP/hooks.d.ts.map +1 -0
  45. package/lib/components/OTP/hooks.js +95 -0
  46. package/lib/components/OTP/hooks.js.map +1 -0
  47. package/lib/components/OTP/index.d.ts +6 -0
  48. package/lib/components/OTP/index.d.ts.map +1 -0
  49. package/lib/components/OTP/types.d.ts +110 -0
  50. package/lib/components/OTP/types.d.ts.map +1 -0
  51. package/lib/components/OTP/utils.d.ts +26 -0
  52. package/lib/components/OTP/utils.d.ts.map +1 -0
  53. package/lib/components/OTP/utils.js +36 -0
  54. package/lib/components/OTP/utils.js.map +1 -0
  55. package/lib/components/PageContainer/PageContainer.d.ts +4 -0
  56. package/lib/components/PageContainer/PageContainer.d.ts.map +1 -0
  57. package/lib/components/PageContainer/PageContainer.js +57 -0
  58. package/lib/components/PageContainer/PageContainer.js.map +1 -0
  59. package/lib/components/PageContainer/index.d.ts +2 -0
  60. package/lib/components/PageContainer/index.d.ts.map +1 -0
  61. package/lib/components/PageContainer/types.d.ts +51 -0
  62. package/lib/components/PageContainer/types.d.ts.map +1 -0
  63. package/lib/components/PageLoading/index.d.ts +6 -0
  64. package/lib/components/PageLoading/index.d.ts.map +1 -0
  65. package/lib/components/PageLoading/index.js +9 -0
  66. package/lib/components/PageLoading/index.js.map +1 -0
  67. package/lib/components/ReactTable/Table.d.ts +18 -0
  68. package/lib/components/ReactTable/Table.d.ts.map +1 -0
  69. package/lib/components/ReactTable/Table.js +151 -0
  70. package/lib/components/ReactTable/Table.js.map +1 -0
  71. package/lib/components/ReactTable/TableFilters.d.ts +8 -0
  72. package/lib/components/ReactTable/TableFilters.d.ts.map +1 -0
  73. package/lib/components/ReactTable/TableFilters.js +58 -0
  74. package/lib/components/ReactTable/TableFilters.js.map +1 -0
  75. package/lib/components/ReactTable/index.d.ts +3 -0
  76. package/lib/components/ReactTable/index.d.ts.map +1 -0
  77. package/lib/components/Spin/index.d.ts +10 -0
  78. package/lib/components/Spin/index.d.ts.map +1 -0
  79. package/lib/components/Spin/index.js +31 -0
  80. package/lib/components/Spin/index.js.map +1 -0
  81. package/lib/components/index.d.ts +9 -0
  82. package/lib/components/index.d.ts.map +1 -0
  83. package/lib/hooks/useToast.d.ts +17 -0
  84. package/lib/hooks/useToast.d.ts.map +1 -0
  85. package/lib/hooks/useToast.js +163 -0
  86. package/lib/hooks/useToast.js.map +1 -0
  87. package/lib/icons/index.d.ts +15 -0
  88. package/lib/icons/index.d.ts.map +1 -0
  89. package/lib/icons/index.js +14 -0
  90. package/lib/icons/index.js.map +1 -0
  91. package/lib/index.d.ts +3 -0
  92. package/lib/index.d.ts.map +1 -0
  93. package/lib/index.js +1 -0
  94. package/lib/index.js.map +1 -0
  95. package/lib/machines/otpMachine.d.ts +3 -0
  96. package/lib/machines/otpMachine.d.ts.map +1 -0
  97. package/lib/machines/otpMachine.js +131 -0
  98. package/lib/machines/otpMachine.js.map +1 -0
  99. package/lib/utils/hooks/useDebounceFn/index.d.ts +8 -0
  100. package/lib/utils/hooks/useDebounceFn/index.d.ts.map +1 -0
  101. package/lib/utils/hooks/useDeepCompareEffect/index.d.ts +5 -0
  102. package/lib/utils/hooks/useDeepCompareEffect/index.d.ts.map +1 -0
  103. package/lib/utils/hooks/useDocumentTitle/index.d.ts +7 -0
  104. package/lib/utils/hooks/useDocumentTitle/index.d.ts.map +1 -0
  105. package/lib/utils/hooks/usePrevious/index.d.ts +3 -0
  106. package/lib/utils/hooks/usePrevious/index.d.ts.map +1 -0
  107. package/lib/utils/hooks/useWindowDimensions/index.d.ts +5 -0
  108. package/lib/utils/hooks/useWindowDimensions/index.d.ts.map +1 -0
  109. package/lib/utils/hooks/useWindowDimensions/index.js +21 -0
  110. package/lib/utils/hooks/useWindowDimensions/index.js.map +1 -0
  111. package/lib/utils/index.d.ts +21 -0
  112. package/lib/utils/index.d.ts.map +1 -0
  113. package/lib/utils/isBrowser/index.d.ts +3 -0
  114. package/lib/utils/isBrowser/index.d.ts.map +1 -0
  115. package/lib/utils/isDropdownValueType/index.d.ts +3 -0
  116. package/lib/utils/isDropdownValueType/index.d.ts.map +1 -0
  117. package/lib/utils/isImg/index.d.ts +4 -0
  118. package/lib/utils/isImg/index.d.ts.map +1 -0
  119. package/lib/utils/isNil/index.d.ts +3 -0
  120. package/lib/utils/isNil/index.d.ts.map +1 -0
  121. package/lib/utils/isUrl/index.d.ts +3 -0
  122. package/lib/utils/isUrl/index.d.ts.map +1 -0
  123. package/lib/utils/omitUndefined/index.d.ts +3 -0
  124. package/lib/utils/omitUndefined/index.d.ts.map +1 -0
  125. package/lib/utils/omitUndefinedAndEmptyArr/index.d.ts +3 -0
  126. package/lib/utils/omitUndefinedAndEmptyArr/index.d.ts.map +1 -0
  127. package/lib/utils/typing.d.ts +142 -0
  128. package/lib/utils/typing.d.ts.map +1 -0
  129. package/package.json +38 -0
@@ -0,0 +1,163 @@
1
+ import {jsxs,jsx,Fragment}from'react/jsx-runtime';import React__default,{createContext,useCallback,useContext}from'react';import {createPortal}from'react-dom';import {icons}from'../icons/index.js';// Context
2
+ const ToastContext = createContext(undefined);
3
+ const {
4
+ CloseIcon,
5
+ CheckCircleIcon,
6
+ ExclamationCircleIcon,
7
+ WarningIcon,
8
+ InfoCircleIcon
9
+ } = icons;
10
+ // Status Icon Component
11
+ const StatusIcon = ({
12
+ status
13
+ }) => {
14
+ switch (status) {
15
+ case 'success':
16
+ return jsx(CheckCircleIcon, {
17
+ className: "w-5 h-5"
18
+ });
19
+ case 'error':
20
+ return jsx(ExclamationCircleIcon, {
21
+ className: "w-5 h-5"
22
+ });
23
+ case 'warning':
24
+ return jsx(WarningIcon, {
25
+ className: "w-5 h-5"
26
+ });
27
+ case 'info':
28
+ return jsx(InfoCircleIcon, {
29
+ className: "w-5 h-5"
30
+ });
31
+ default:
32
+ return null;
33
+ }
34
+ };
35
+ // Toast Component
36
+ const Toast = ({
37
+ id,
38
+ title,
39
+ description,
40
+ status = 'info',
41
+ duration = 5000,
42
+ isClosable = true,
43
+ position = 'top-right',
44
+ onClose
45
+ }) => {
46
+ const [isVisible, setIsVisible] = React__default.useState(true);
47
+ React__default.useEffect(() => {
48
+ if (duration !== null) {
49
+ const timer = setTimeout(() => {
50
+ setIsVisible(false);
51
+ setTimeout(() => {
52
+ onClose?.();
53
+ }, 300); // Allow time for exit animation
54
+ }, duration);
55
+ return () => clearTimeout(timer);
56
+ }
57
+ }, [duration, onClose]);
58
+ const handleClose = () => {
59
+ setIsVisible(false);
60
+ setTimeout(() => {
61
+ onClose?.();
62
+ }, 300); // Allow time for exit animation
63
+ };
64
+ // Status-based styling
65
+ const statusClasses = {
66
+ success: 'bg-green-500',
67
+ error: 'bg-red-500',
68
+ warning: 'bg-yellow-500',
69
+ info: 'bg-blue-500'
70
+ };
71
+ // Position classes
72
+ const positionClasses = {
73
+ top: 'top-4 left-1/2 transform -translate-x-1/2',
74
+ 'top-right': 'top-4 right-4',
75
+ 'top-left': 'top-4 left-4',
76
+ bottom: 'bottom-4 left-1/2 transform -translate-x-1/2',
77
+ 'bottom-right': 'bottom-4 right-4',
78
+ 'bottom-left': 'bottom-4 left-4'
79
+ };
80
+ return jsx("div", {
81
+ className: `fixed ${positionClasses[position]} z-50 transition-all duration-300 ease-in-out ${isVisible ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-2'}`,
82
+ role: "alert",
83
+ "aria-live": "assertive",
84
+ "data-testid": "toast",
85
+ children: jsxs("div", {
86
+ className: `${statusClasses[status]} text-white p-4 rounded-md shadow-lg min-w-[300px] max-w-md flex items-start`,
87
+ children: [jsx("div", {
88
+ className: "mr-3 flex-shrink-0 mt-0.5",
89
+ children: jsx(StatusIcon, {
90
+ status: status
91
+ })
92
+ }), jsxs("div", {
93
+ className: "flex-1",
94
+ children: [title && jsx("h3", {
95
+ className: "font-bold",
96
+ children: title
97
+ }), description && jsx("p", {
98
+ className: "text-sm mt-1",
99
+ children: description
100
+ })]
101
+ }), isClosable && jsx("button", {
102
+ onClick: handleClose,
103
+ className: "ml-4 text-white opacity-70 hover:opacity-100 transition-opacity flex-shrink-0",
104
+ "aria-label": "Close toast",
105
+ children: jsx(CloseIcon, {
106
+ className: "w-4 h-4"
107
+ })
108
+ })]
109
+ })
110
+ });
111
+ };
112
+ // Toast Container Component
113
+ const ToastContainer = ({
114
+ children
115
+ }) => {
116
+ const [toasts, setToasts] = React__default.useState([]);
117
+ const toast = useCallback(options => {
118
+ const id = Math.random().toString(36).substring(2, 9);
119
+ setToasts(prev => [...prev, {
120
+ ...options,
121
+ id
122
+ }]);
123
+ }, []);
124
+ const closeToast = useCallback(id => {
125
+ setToasts(prev => prev.filter(toast => toast.id !== id));
126
+ }, []);
127
+ const closeAll = useCallback(() => {
128
+ setToasts([]);
129
+ }, []);
130
+ const value = React__default.useMemo(() => ({
131
+ toast,
132
+ closeAll
133
+ }), [toast, closeAll]);
134
+ return jsxs(ToastContext.Provider, {
135
+ value: value,
136
+ children: [children, typeof window !== 'undefined' && createPortal(jsx(Fragment, {
137
+ children: toasts.map(({
138
+ id,
139
+ ...toastProps
140
+ }) => jsx(Toast, {
141
+ id: id,
142
+ ...toastProps,
143
+ onClose: () => closeToast(id)
144
+ }, id))
145
+ }), document.body)]
146
+ });
147
+ };
148
+ // Hook to use the toast
149
+ const useToast = () => {
150
+ const context = useContext(ToastContext);
151
+ if (context === undefined) {
152
+ throw new Error('useToast must be used within a ToastContainer');
153
+ }
154
+ return context.toast;
155
+ };
156
+ // Hook to use closeAll
157
+ const useToastCloseAll = () => {
158
+ const context = useContext(ToastContext);
159
+ if (context === undefined) {
160
+ throw new Error('useToastCloseAll must be used within a ToastContainer');
161
+ }
162
+ return context.closeAll;
163
+ };export{ToastContainer,useToast,useToastCloseAll};//# sourceMappingURL=useToast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToast.js","sources":["../../src/hooks/useToast.tsx"],"sourcesContent":[null],"names":[],"mappings":";MAUU,YAAG,GAAA,aAAY,CAAA,SAAA,CAAA;MACb;WACE;AACV,EAAA,eAAgB;AAChB,EAAA,qBAAgB;AACnB,EAAA,WAAA;AA+GD,EAAO;AAAwC,CAAA,GAAA,KAAA;AAA2B;AAmC1E,MAAA;AASA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,15 @@
1
+ export declare const icons: {
2
+ ExclamationCircleIcon: import("@react-icons/all-files/lib").IconType;
3
+ TimesIcon: import("@react-icons/all-files/lib").IconType;
4
+ OutlineLeftIcon: import("@react-icons/all-files/lib").IconType;
5
+ OutlineRightIcon: import("@react-icons/all-files/lib").IconType;
6
+ CloseIcon: import("@react-icons/all-files/lib").IconType;
7
+ CheckCircleIcon: import("@react-icons/all-files/lib").IconType;
8
+ WarningIcon: import("@react-icons/all-files/lib").IconType;
9
+ InfoCircleIcon: import("@react-icons/all-files/lib").IconType;
10
+ KeyIcon: import("@react-icons/all-files/lib").IconType;
11
+ AlertIcon: import("@react-icons/all-files/lib").IconType;
12
+ LockIcon: import("@react-icons/all-files/lib").IconType;
13
+ CheckIcon: import("@react-icons/all-files/lib").IconType;
14
+ };
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/icons/index.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,KAAK;;;;;;;;;;;;;CAajB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import {AiOutlineExclamationCircle}from'@react-icons/all-files/ai/AiOutlineExclamationCircle.js';import {FaTimes}from'@react-icons/all-files/fa/FaTimes.js';import {AiOutlineLeft}from'@react-icons/all-files/ai/AiOutlineLeft.js';import {AiOutlineRight}from'@react-icons/all-files/ai/AiOutlineRight.js';import {AiOutlineClose}from'@react-icons/all-files/ai/AiOutlineClose.js';import {AiOutlineCheckCircle}from'@react-icons/all-files/ai/AiOutlineCheckCircle.js';import {AiOutlineWarning}from'@react-icons/all-files/ai/AiOutlineWarning.js';import {AiOutlineInfoCircle}from'@react-icons/all-files/ai/AiOutlineInfoCircle.js';import {IoKeyOutline}from'@react-icons/all-files/io5/IoKeyOutline.js';import {IoAlertCircleOutline}from'@react-icons/all-files/io5/IoAlertCircleOutline.js';import {MdLockOutline}from'@react-icons/all-files/md/MdLockOutline.js';import {FaCheck}from'@react-icons/all-files/fa/FaCheck.js';const icons = {
2
+ ExclamationCircleIcon: AiOutlineExclamationCircle,
3
+ TimesIcon: FaTimes,
4
+ OutlineLeftIcon: AiOutlineLeft,
5
+ OutlineRightIcon: AiOutlineRight,
6
+ CloseIcon: AiOutlineClose,
7
+ CheckCircleIcon: AiOutlineCheckCircle,
8
+ WarningIcon: AiOutlineWarning,
9
+ InfoCircleIcon: AiOutlineInfoCircle,
10
+ KeyIcon: IoKeyOutline,
11
+ AlertIcon: IoAlertCircleOutline,
12
+ LockIcon: MdLockOutline,
13
+ CheckIcon: FaCheck
14
+ };export{icons};//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/icons/index.ts"],"sourcesContent":[null],"names":["ExclamationCircleIcon"],"mappings":";yBA6BEA,0BAAA;;;;;;;;;;;;"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './components';
2
+ export * from './hooks/useToast';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1 @@
1
+ export{default as PageLoading}from'./components/PageLoading/index.js';export{ApplicationErrorHandler}from'./components/ErrorHandlers/ApplicationErrorHandler.js';export{ErrorBoundary}from'./components/ErrorHandlers/ErrorBoundary.js';export{LayoutErrorBoundary}from'./components/ErrorHandlers/LayoutErrorBoundary.js';export{ReactTable}from'./components/ReactTable/Table.js';export{DefaultColumnFilter,SelectColumnFilter}from'./components/ReactTable/TableFilters.js';export{Error404}from'./components/ErrorPages/404.js';export{Error500}from'./components/ErrorPages/500.js';export{Error403}from'./components/ErrorPages/403.js';export{PageContainer}from'./components/PageContainer/PageContainer.js';export{Spin}from'./components/Spin/index.js';export{OTPInput}from'./components/OTP/OTPInput.js';export{SingleInput}from'./components/OTP/SingleInput.js';export{useOTPInput}from'./components/OTP/hooks.js';export{OTPVerification}from'./components/OTP/OTPVerification.js';export{ToastContainer,useToast,useToastCloseAll}from'./hooks/useToast.js';//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { OTPInputMachineContext, OTPInputMachineEvent } from '../components/OTP/types';
2
+ export declare const createOTPInputMachine: (numInputs: number, inputType: string) => import("xstate").StateMachine<OTPInputMachineContext, OTPInputMachineEvent, Record<string, import("xstate").AnyActorRef>, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, string, import("xstate").StateValue, string, unknown, {}, import("xstate").EventObject, import("xstate").MetaObject, any>;
3
+ //# sourceMappingURL=otpMachine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otpMachine.d.ts","sourceRoot":"","sources":["../../src/machines/otpMachine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGvF,eAAO,MAAM,qBAAqB,cAAe,MAAM,aAAa,MAAM,oWAyHzE,CAAC"}
@@ -0,0 +1,131 @@
1
+ import {createMachine,assign}from'xstate';import {isInputNumeric,isInputValueValid,getNextInputIndex}from'../components/OTP/utils.js';const createOTPInputMachine = (numInputs, inputType) => {
2
+ return createMachine({
3
+ id: 'otpInput',
4
+ types: {},
5
+ initial: 'idle',
6
+ context: {
7
+ otp: Array(numInputs).fill(''),
8
+ activeInput: 0,
9
+ numInputs,
10
+ inputType: inputType
11
+ },
12
+ states: {
13
+ idle: {
14
+ on: {
15
+ CHANGE: {
16
+ actions: assign({
17
+ otp: ({
18
+ context,
19
+ event
20
+ }) => {
21
+ const isInputNum = isInputNumeric(context.inputType);
22
+ if (!isInputValueValid(event.value, isInputNum)) return context.otp;
23
+ const newOtp = [...context.otp];
24
+ newOtp[context.activeInput] = event.value;
25
+ return newOtp;
26
+ },
27
+ activeInput: ({
28
+ context
29
+ }) => getNextInputIndex(context.activeInput, 1, context.numInputs - 1)
30
+ })
31
+ },
32
+ INPUT_CHANGE: {
33
+ actions: assign({
34
+ otp: ({
35
+ context,
36
+ event
37
+ }) => {
38
+ const isInputNum = isInputNumeric(context.inputType);
39
+ const {
40
+ value
41
+ } = event;
42
+ if (value.length === context.numInputs) {
43
+ const chars = value.split('');
44
+ const hasInvalidInput = chars.some(char => !isInputValueValid(char, isInputNum));
45
+ if (!hasInvalidInput) {
46
+ return chars;
47
+ }
48
+ }
49
+ return context.otp;
50
+ }
51
+ })
52
+ },
53
+ FOCUS: {
54
+ actions: assign({
55
+ activeInput: ({
56
+ event
57
+ }) => event.index
58
+ })
59
+ },
60
+ BLUR: {
61
+ actions: assign({
62
+ activeInput: ({
63
+ context
64
+ }) => context.activeInput
65
+ })
66
+ },
67
+ KEY_DOWN: {
68
+ actions: assign(({
69
+ context,
70
+ event
71
+ }) => {
72
+ const {
73
+ key,
74
+ code
75
+ } = event;
76
+ let newOtp = [...context.otp];
77
+ let newActiveInput = context.activeInput;
78
+ if (code === 'Backspace' || key === 'Backspace') {
79
+ newOtp[context.activeInput] = '';
80
+ newActiveInput = getNextInputIndex(context.activeInput, -1, context.numInputs - 1);
81
+ } else if (code === 'Delete' || key === 'Delete') {
82
+ newOtp[context.activeInput] = '';
83
+ } else if (code === 'ArrowLeft' || key === 'ArrowLeft') {
84
+ newActiveInput = getNextInputIndex(context.activeInput, -1, context.numInputs - 1);
85
+ } else if (code === 'ArrowRight' || key === 'ArrowRight') {
86
+ newActiveInput = getNextInputIndex(context.activeInput, 1, context.numInputs - 1);
87
+ } else if (key === newOtp[context.activeInput]) {
88
+ newActiveInput = getNextInputIndex(context.activeInput, 1, context.numInputs - 1);
89
+ }
90
+ return {
91
+ otp: newOtp,
92
+ activeInput: newActiveInput
93
+ };
94
+ })
95
+ },
96
+ PASTE: {
97
+ actions: assign(({
98
+ context,
99
+ event
100
+ }) => {
101
+ const isInputNum = isInputNumeric(context.inputType);
102
+ const pastedData = event.pastedData.slice(0, context.numInputs - context.activeInput).split('');
103
+ if (isInputNum && pastedData.some(value => isNaN(Number(value)))) {
104
+ return context;
105
+ }
106
+ const newOtp = [...context.otp];
107
+ let nextActiveInput = context.activeInput;
108
+ for (let pos = 0; pos < context.numInputs; ++pos) {
109
+ if (pos >= context.activeInput && pastedData.length > 0) {
110
+ newOtp[pos] = pastedData.shift() ?? '';
111
+ nextActiveInput++;
112
+ }
113
+ }
114
+ return {
115
+ otp: newOtp,
116
+ activeInput: Math.min(nextActiveInput, context.numInputs - 1)
117
+ };
118
+ })
119
+ },
120
+ SET_OTP: {
121
+ actions: assign({
122
+ otp: ({
123
+ event
124
+ }) => event.otp
125
+ })
126
+ }
127
+ }
128
+ }
129
+ }
130
+ });
131
+ };export{createOTPInputMachine};//# sourceMappingURL=otpMachine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otpMachine.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ import { DependencyList } from 'react';
2
+ export interface ReturnValue<T extends any[]> {
3
+ run: (...args: T) => void;
4
+ cancel: () => void;
5
+ }
6
+ declare function useDebounceFn<T extends any[]>(fn: (...args: T) => Promise<any>, deps: DependencyList | number, wait?: number): ReturnValue<T>;
7
+ export default useDebounceFn;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/useDebounceFn/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,cAAc,EAAe,MAAM,OAAO,CAAC;AAEvE,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,GAAG,EAAE;IACxC,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AAcD,iBAAS,aAAa,CAAC,CAAC,SAAS,GAAG,EAAE,EAClC,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,EAChC,IAAI,EAAE,cAAc,GAAG,MAAM,EAC7B,IAAI,CAAC,EAAE,MAAM,GACd,WAAW,CAAC,CAAC,CAAC,CAuChB;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { DependencyList } from 'react';
2
+ export declare const isDeepEqual: (a: any, b: any) => boolean;
3
+ declare function useDeepCompareEffect(effect: React.EffectCallback, dependencies?: DependencyList): void;
4
+ export default useDeepCompareEffect;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/useDeepCompareEffect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqB,MAAM,OAAO,CAAC;AAG1D,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,OAA0B,CAAC;AAazE,iBAAS,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,EAAE,YAAY,GAAE,cAAmB,QAE5F;AAED,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,7 @@
1
+ declare function useDocumentTitle(titleInfo: {
2
+ title: string;
3
+ id: string;
4
+ pageName: string;
5
+ }, appDefaultTitle: string | false): void;
6
+ export default useDocumentTitle;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/useDocumentTitle/index.ts"],"names":[],"mappings":"AAGA,iBAAS,gBAAgB,CACrB,SAAS,EAAE;IACP,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CACpB,EACD,eAAe,EAAE,MAAM,GAAG,KAAK,QAQlC;AAED,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const usePrevious: <T>(state: T) => T | undefined;
2
+ export default usePrevious;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/usePrevious/index.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,WAAW,GAAI,CAAC,SAAS,CAAC,KAAG,CAAC,GAAG,SAQtC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,5 @@
1
+ export default function useWindowDimensions(): {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/useWindowDimensions/index.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,mBAAmB;;;EAa1C"}
@@ -0,0 +1,21 @@
1
+ import {useState,useEffect}from'react';function getWindowDimensions() {
2
+ const {
3
+ innerWidth: width,
4
+ innerHeight: height
5
+ } = window;
6
+ return {
7
+ width,
8
+ height
9
+ };
10
+ }
11
+ function useWindowDimensions() {
12
+ const [windowDimensions, setWindowDimensions] = useState(getWindowDimensions());
13
+ useEffect(() => {
14
+ function handleResize() {
15
+ setWindowDimensions(getWindowDimensions());
16
+ }
17
+ window.addEventListener('resize', handleResize);
18
+ return () => window.removeEventListener('resize', handleResize);
19
+ }, []);
20
+ return windowDimensions;
21
+ }export{useWindowDimensions as default};//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/utils/hooks/useWindowDimensions/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAuBC,IAAA,UAAA,EAAA,KAAA;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,21 @@
1
+ import isBrowser from './isBrowser';
2
+ import isImg from './isImg';
3
+ import isUrl from './isUrl';
4
+ import isNil from './isNil';
5
+ import isDropdownValueType from './isDropdownValueType';
6
+ import omitUndefined from './omitUndefined';
7
+ import omitUndefinedAndEmptyArr from './omitUndefinedAndEmptyArr';
8
+ /**
9
+ * hooks
10
+ */
11
+ import useDebounceFn from './hooks/useDebounceFn';
12
+ import usePrevious from './hooks/usePrevious';
13
+ import useDeepCompareEffect from './hooks/useDeepCompareEffect';
14
+ import useDocumentTitle from './hooks/useDocumentTitle';
15
+ /**
16
+ * type
17
+ */
18
+ import { ProSchema, ProSchemaValueEnumMap, ProSchemaValueEnumObj, ProSchemaComponentTypes, ProCoreActionType, SearchTransformKeyFn } from './typing';
19
+ export type { ProSchema, ProCoreActionType, ProSchemaComponentTypes, ProSchemaValueEnumMap, ProSchemaValueEnumObj, SearchTransformKeyFn, };
20
+ export { useDocumentTitle, isImg, isNil, isDropdownValueType, omitUndefined, omitUndefinedAndEmptyArr, isUrl, isBrowser, usePrevious, useDebounceFn, useDeepCompareEffect, };
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAElE;;GAEG;AACH,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAClD,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AAExD;;GAEG;AACH,OAAO,EACH,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACvB,MAAM,UAAU,CAAC;AAElB,YAAY,EACR,SAAS,EACT,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,GACvB,CAAC;AAEF,OAAO,EACH,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,mBAAmB,EACnB,aAAa,EACb,wBAAwB,EACxB,KAAK,EACL,SAAS,EACT,WAAW,EACX,aAAa,EACb,oBAAoB,GACvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const isBrowser: () => boolean;
2
+ export default isBrowser;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/isBrowser/index.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,eAKd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const isDropdownValueType: (valueType: string) => boolean;
2
+ export default isDropdownValueType;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/isDropdownValueType/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,mBAAmB,cAAe,MAAM,YAM7C,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Determine whether it is a picture link */
2
+ declare function isImg(path: string): boolean;
3
+ export default isImg;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/isImg/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,iBAAS,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpC;AAED,eAAe,KAAK,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const isNil: (value: any) => boolean;
2
+ export default isNil;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/isNil/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,KAAK,UAAW,GAAG,YAA0C,CAAC;AAEpE,eAAe,KAAK,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const isUrl: (path: string) => boolean;
2
+ export default isUrl;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/isUrl/index.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,KAAK,SAAU,MAAM,KAAG,OAAyB,CAAC;AAExD,eAAe,KAAK,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const omitUndefined: <T>(obj: T) => T;
2
+ export default omitUndefined;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/omitUndefined/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa,GAAI,CAAC,OAAO,CAAC,KAAG,CAQlC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const omitUndefinedAndEmptyArr: <T>(obj: T) => T;
2
+ export default omitUndefinedAndEmptyArr;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/omitUndefinedAndEmptyArr/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,wBAAwB,GAAI,CAAC,OAAO,CAAC,KAAG,CAY7C,CAAC;AAEF,eAAe,wBAAwB,CAAC"}