@pisell/private-materials 3.4.16 → 3.4.18

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 (211) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/appointmentBooking/components/Content/index.js +1 -1
  12. package/es/components/appointmentBooking/components/Content/index.less +3 -3
  13. package/es/components/appointmentBooking/components/Services/index.js +2 -2
  14. package/es/components/appointmentBooking/index.js +8 -2
  15. package/es/components/booking/info2/service/addTimeModal/index.js +0 -1
  16. package/es/components/booking/utils.d.ts +2 -2
  17. package/es/components/eftposPay/hooks.d.ts +1 -1
  18. package/es/components/eftposPay/store/index.d.ts +2 -2
  19. package/es/components/eventBooking/index.js +8 -1
  20. package/es/components/ticketBooking/components/addServiceVariant/addService.js +3 -3
  21. package/es/hooks/useWindowSize.js +8 -1
  22. package/es/index.d.ts +3 -0
  23. package/es/index.js +4 -1
  24. package/es/plus/productSelect/CategoryTabs/CategorySkeleton.d.ts +10 -0
  25. package/es/plus/productSelect/CategoryTabs/CategorySkeleton.js +29 -0
  26. package/es/plus/productSelect/CategoryTabs/CategorySkeleton.less +30 -0
  27. package/es/plus/productSelect/CategoryTabs/index.d.ts +18 -0
  28. package/es/plus/productSelect/CategoryTabs/index.js +171 -0
  29. package/es/plus/productSelect/ProductCard/ProductCardSkeleton.d.ts +10 -0
  30. package/es/plus/productSelect/ProductCard/ProductCardSkeleton.js +37 -0
  31. package/es/plus/productSelect/ProductCard/ProductCardSkeleton.less +81 -0
  32. package/es/plus/productSelect/ProductCard/index.d.ts +45 -0
  33. package/es/plus/productSelect/ProductCard/index.js +170 -0
  34. package/es/plus/productSelect/ProductCard/index.less +253 -0
  35. package/es/plus/productSelect/ProductList/gridComponents.d.ts +44 -0
  36. package/es/plus/productSelect/ProductList/gridComponents.js +149 -0
  37. package/es/plus/productSelect/ProductList/index.d.ts +22 -0
  38. package/es/plus/productSelect/ProductList/index.js +72 -0
  39. package/es/plus/productSelect/ProductList/index.less +0 -0
  40. package/es/plus/productSelect/components/IntersectionObserver.d.ts +42 -0
  41. package/es/plus/productSelect/components/IntersectionObserver.js +276 -0
  42. package/es/plus/productSelect/components/TabsStructure/TabsStructure.d.ts +30 -0
  43. package/es/plus/productSelect/components/TabsStructure/TabsStructure.js +357 -0
  44. package/es/plus/productSelect/components/TabsStructure/TabsStructure.less +224 -0
  45. package/es/plus/productSelect/components/TabsStructure/hooks.d.ts +22 -0
  46. package/es/plus/productSelect/components/TabsStructure/hooks.js +243 -0
  47. package/es/plus/productSelect/components/TabsStructure/index.d.ts +5 -0
  48. package/es/plus/productSelect/components/TabsStructure/index.js +13 -0
  49. package/es/plus/productSelect/components/TabsStructure/styles.d.ts +47 -0
  50. package/es/plus/productSelect/components/TabsStructure/styles.js +87 -0
  51. package/es/plus/productSelect/components/TabsStructure/types.d.ts +105 -0
  52. package/es/plus/productSelect/components/TabsStructure/types.js +1 -0
  53. package/es/plus/productSelect/components/TabsStructure/utils.d.ts +12 -0
  54. package/es/plus/productSelect/components/TabsStructure/utils.js +56 -0
  55. package/es/plus/productSelect/components/pisellPriceText/index.d.ts +12 -0
  56. package/es/plus/productSelect/components/pisellPriceText/index.js +44 -0
  57. package/es/plus/productSelect/components/pisellPriceText/index.less +4 -0
  58. package/es/plus/productSelect/hooks/useToken.d.ts +18 -0
  59. package/es/plus/productSelect/hooks/useToken.js +34 -0
  60. package/es/plus/productSelect/index.d.ts +31 -0
  61. package/es/plus/productSelect/index.js +270 -0
  62. package/es/plus/productSelect/index.less +56 -0
  63. package/es/plus/productSelect/locales.d.ts +18 -0
  64. package/es/plus/productSelect/locales.js +17 -0
  65. package/es/plus/productSelect/theme/token.d.ts +17 -0
  66. package/es/plus/productSelect/theme/token.js +19 -0
  67. package/es/plus/productSelect/utils.d.ts +39 -0
  68. package/es/plus/productSelect/utils.js +162 -0
  69. package/es/plus/saasCreateOrganization/components/Header.d.ts +3 -0
  70. package/es/plus/saasCreateOrganization/components/Header.js +62 -0
  71. package/es/plus/saasCreateOrganization/index.d.ts +4 -0
  72. package/es/plus/saasCreateOrganization/index.js +15 -0
  73. package/es/plus/saasCreateOrganization/index.less +55 -0
  74. package/es/plus/saasCreateOrganization/locales.d.ts +15 -0
  75. package/es/plus/saasCreateOrganization/locales.js +14 -0
  76. package/es/plus/saasCreateOrganization/types.d.ts +69 -0
  77. package/es/plus/saasCreateOrganization/types.js +1 -0
  78. package/es/plus/saasLogin/index.d.ts +5 -0
  79. package/es/plus/saasLogin/index.js +165 -0
  80. package/es/plus/saasLogin/index.less +136 -0
  81. package/es/plus/saasLogin/locales.d.ts +51 -0
  82. package/es/plus/saasLogin/locales.js +50 -0
  83. package/es/plus/saasLogin/types.d.ts +62 -0
  84. package/es/plus/saasLogin/types.js +1 -0
  85. package/es/plus/saasLogin/utils.d.ts +35 -0
  86. package/es/plus/saasLogin/utils.js +31 -0
  87. package/es/plus/saasRegister/components/EntryEmail.d.ts +9 -0
  88. package/es/plus/saasRegister/components/EntryEmail.js +92 -0
  89. package/es/plus/saasRegister/components/EntryInfo.d.ts +9 -0
  90. package/es/plus/saasRegister/components/EntryInfo.js +145 -0
  91. package/es/plus/saasRegister/components/GoLogin.d.ts +4 -0
  92. package/es/plus/saasRegister/components/GoLogin.js +27 -0
  93. package/es/plus/saasRegister/components/Header.d.ts +3 -0
  94. package/es/plus/saasRegister/components/Header.js +62 -0
  95. package/es/plus/saasRegister/components/VerifyError.d.ts +8 -0
  96. package/es/plus/saasRegister/components/VerifyError.js +68 -0
  97. package/es/plus/saasRegister/components/VerifyingLink.d.ts +5 -0
  98. package/es/plus/saasRegister/components/VerifyingLink.js +16 -0
  99. package/es/plus/saasRegister/components/VertifyEmail.d.ts +7 -0
  100. package/es/plus/saasRegister/components/VertifyEmail.js +121 -0
  101. package/es/plus/saasRegister/index.d.ts +5 -0
  102. package/es/plus/saasRegister/index.js +246 -0
  103. package/es/plus/saasRegister/index.less +218 -0
  104. package/es/plus/saasRegister/locales.d.ts +117 -0
  105. package/es/plus/saasRegister/locales.js +116 -0
  106. package/es/plus/saasRegister/types.d.ts +114 -0
  107. package/es/plus/saasRegister/types.js +24 -0
  108. package/lib/components/appointmentBooking/components/Content/index.js +1 -1
  109. package/lib/components/appointmentBooking/components/Content/index.less +3 -3
  110. package/lib/components/appointmentBooking/components/Services/index.js +2 -2
  111. package/lib/components/appointmentBooking/index.js +6 -1
  112. package/lib/components/booking/info2/service/addTimeModal/index.js +0 -1
  113. package/lib/components/booking/utils.d.ts +2 -2
  114. package/lib/components/eftposPay/hooks.d.ts +1 -1
  115. package/lib/components/eftposPay/store/index.d.ts +2 -2
  116. package/lib/components/eventBooking/index.js +6 -1
  117. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +3 -3
  118. package/lib/hooks/useWindowSize.js +6 -1
  119. package/lib/index.d.ts +3 -0
  120. package/lib/index.js +9 -0
  121. package/lib/plus/productSelect/CategoryTabs/CategorySkeleton.d.ts +10 -0
  122. package/lib/plus/productSelect/CategoryTabs/CategorySkeleton.js +62 -0
  123. package/lib/plus/productSelect/CategoryTabs/CategorySkeleton.less +30 -0
  124. package/lib/plus/productSelect/CategoryTabs/index.d.ts +18 -0
  125. package/lib/plus/productSelect/CategoryTabs/index.js +183 -0
  126. package/lib/plus/productSelect/ProductCard/ProductCardSkeleton.d.ts +10 -0
  127. package/lib/plus/productSelect/ProductCard/ProductCardSkeleton.js +58 -0
  128. package/lib/plus/productSelect/ProductCard/ProductCardSkeleton.less +81 -0
  129. package/lib/plus/productSelect/ProductCard/index.d.ts +45 -0
  130. package/lib/plus/productSelect/ProductCard/index.js +184 -0
  131. package/lib/plus/productSelect/ProductCard/index.less +253 -0
  132. package/lib/plus/productSelect/ProductList/gridComponents.d.ts +44 -0
  133. package/lib/plus/productSelect/ProductList/gridComponents.js +148 -0
  134. package/lib/plus/productSelect/ProductList/index.d.ts +22 -0
  135. package/lib/plus/productSelect/ProductList/index.js +86 -0
  136. package/lib/plus/productSelect/ProductList/index.less +0 -0
  137. package/lib/plus/productSelect/components/IntersectionObserver.d.ts +42 -0
  138. package/lib/plus/productSelect/components/IntersectionObserver.js +269 -0
  139. package/lib/plus/productSelect/components/TabsStructure/TabsStructure.d.ts +30 -0
  140. package/lib/plus/productSelect/components/TabsStructure/TabsStructure.js +393 -0
  141. package/lib/plus/productSelect/components/TabsStructure/TabsStructure.less +224 -0
  142. package/lib/plus/productSelect/components/TabsStructure/hooks.d.ts +22 -0
  143. package/lib/plus/productSelect/components/TabsStructure/hooks.js +209 -0
  144. package/lib/plus/productSelect/components/TabsStructure/index.d.ts +5 -0
  145. package/lib/plus/productSelect/components/TabsStructure/index.js +92 -0
  146. package/lib/plus/productSelect/components/TabsStructure/styles.d.ts +47 -0
  147. package/lib/plus/productSelect/components/TabsStructure/styles.js +122 -0
  148. package/lib/plus/productSelect/components/TabsStructure/types.d.ts +105 -0
  149. package/lib/plus/productSelect/components/TabsStructure/types.js +17 -0
  150. package/lib/plus/productSelect/components/TabsStructure/utils.d.ts +12 -0
  151. package/lib/plus/productSelect/components/TabsStructure/utils.js +72 -0
  152. package/lib/plus/productSelect/components/pisellPriceText/index.d.ts +12 -0
  153. package/lib/plus/productSelect/components/pisellPriceText/index.js +73 -0
  154. package/lib/plus/productSelect/components/pisellPriceText/index.less +4 -0
  155. package/lib/plus/productSelect/hooks/useToken.d.ts +18 -0
  156. package/lib/plus/productSelect/hooks/useToken.js +50 -0
  157. package/lib/plus/productSelect/index.d.ts +31 -0
  158. package/lib/plus/productSelect/index.js +299 -0
  159. package/lib/plus/productSelect/index.less +56 -0
  160. package/lib/plus/productSelect/locales.d.ts +18 -0
  161. package/lib/plus/productSelect/locales.js +41 -0
  162. package/lib/plus/productSelect/theme/token.d.ts +17 -0
  163. package/lib/plus/productSelect/theme/token.js +47 -0
  164. package/lib/plus/productSelect/utils.d.ts +39 -0
  165. package/lib/plus/productSelect/utils.js +138 -0
  166. package/lib/plus/saasCreateOrganization/components/Header.d.ts +3 -0
  167. package/lib/plus/saasCreateOrganization/components/Header.js +99 -0
  168. package/lib/plus/saasCreateOrganization/index.d.ts +4 -0
  169. package/lib/plus/saasCreateOrganization/index.js +47 -0
  170. package/lib/plus/saasCreateOrganization/index.less +55 -0
  171. package/lib/plus/saasCreateOrganization/locales.d.ts +15 -0
  172. package/lib/plus/saasCreateOrganization/locales.js +38 -0
  173. package/lib/plus/saasCreateOrganization/types.d.ts +69 -0
  174. package/lib/plus/saasCreateOrganization/types.js +17 -0
  175. package/lib/plus/saasLogin/index.d.ts +5 -0
  176. package/lib/plus/saasLogin/index.js +171 -0
  177. package/lib/plus/saasLogin/index.less +136 -0
  178. package/lib/plus/saasLogin/locales.d.ts +51 -0
  179. package/lib/plus/saasLogin/locales.js +74 -0
  180. package/lib/plus/saasLogin/types.d.ts +62 -0
  181. package/lib/plus/saasLogin/types.js +17 -0
  182. package/lib/plus/saasLogin/utils.d.ts +35 -0
  183. package/lib/plus/saasLogin/utils.js +50 -0
  184. package/lib/plus/saasRegister/components/EntryEmail.d.ts +9 -0
  185. package/lib/plus/saasRegister/components/EntryEmail.js +92 -0
  186. package/lib/plus/saasRegister/components/EntryInfo.d.ts +9 -0
  187. package/lib/plus/saasRegister/components/EntryInfo.js +128 -0
  188. package/lib/plus/saasRegister/components/GoLogin.d.ts +4 -0
  189. package/lib/plus/saasRegister/components/GoLogin.js +58 -0
  190. package/lib/plus/saasRegister/components/Header.d.ts +3 -0
  191. package/lib/plus/saasRegister/components/Header.js +99 -0
  192. package/lib/plus/saasRegister/components/VerifyError.d.ts +8 -0
  193. package/lib/plus/saasRegister/components/VerifyError.js +123 -0
  194. package/lib/plus/saasRegister/components/VerifyingLink.d.ts +5 -0
  195. package/lib/plus/saasRegister/components/VerifyingLink.js +44 -0
  196. package/lib/plus/saasRegister/components/VertifyEmail.d.ts +7 -0
  197. package/lib/plus/saasRegister/components/VertifyEmail.js +110 -0
  198. package/lib/plus/saasRegister/index.d.ts +5 -0
  199. package/lib/plus/saasRegister/index.js +205 -0
  200. package/lib/plus/saasRegister/index.less +218 -0
  201. package/lib/plus/saasRegister/locales.d.ts +117 -0
  202. package/lib/plus/saasRegister/locales.js +140 -0
  203. package/lib/plus/saasRegister/types.d.ts +114 -0
  204. package/lib/plus/saasRegister/types.js +54 -0
  205. package/lowcode/saas-create-organization/meta.ts +214 -0
  206. package/lowcode/saas-create-organization/snippets.ts +25 -0
  207. package/lowcode/saas-login/meta.ts +370 -0
  208. package/lowcode/saas-login/snippets.ts +38 -0
  209. package/lowcode/saas-register/meta.ts +386 -0
  210. package/lowcode/saas-register/snippets.ts +31 -0
  211. package/package.json +2 -2
@@ -0,0 +1,269 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/plus/productSelect/components/IntersectionObserver.tsx
30
+ var IntersectionObserver_exports = {};
31
+ __export(IntersectionObserver_exports, {
32
+ IntersectionObserverConsumer: () => Consumer,
33
+ IntersectionObserverContext: () => IntersectionObserverContext,
34
+ IntersectionObserverProvider: () => IntersectionObserverProvider,
35
+ IntersectionTrigger: () => IntersectionTrigger,
36
+ default: () => IntersectionObserver_default
37
+ });
38
+ module.exports = __toCommonJS(IntersectionObserver_exports);
39
+ var import_react = __toESM(require("react"));
40
+ var IntersectionObserverContext = (0, import_react.createContext)({
41
+ initialized: false,
42
+ register: () => {
43
+ },
44
+ unregister: () => {
45
+ }
46
+ });
47
+ var { Provider, Consumer } = IntersectionObserverContext;
48
+ var IntersectionObserverProvider = ({
49
+ children,
50
+ root = null,
51
+ rootMargin = "0px",
52
+ threshold = 0,
53
+ priorityMode
54
+ }) => {
55
+ const [mounted, setMounted] = (0, import_react.useState)(false);
56
+ const [initialized, setInitialized] = (0, import_react.useState)(false);
57
+ const observerRef = (0, import_react.useRef)(null);
58
+ const callbackMapRef = (0, import_react.useRef)(/* @__PURE__ */ new Map());
59
+ const findCallback = (0, import_react.useCallback)((target) => {
60
+ return callbackMapRef.current.get(target);
61
+ }, []);
62
+ const selectPriorityEntry = (0, import_react.useCallback)(
63
+ (entries, mode) => {
64
+ if (entries.length === 0) return void 0;
65
+ if (entries.length === 1) return entries[0];
66
+ switch (mode) {
67
+ case "top":
68
+ return entries.reduce(
69
+ (prev, curr) => curr.boundingClientRect.top < prev.boundingClientRect.top ? curr : prev
70
+ );
71
+ case "bottom":
72
+ return entries.reduce(
73
+ (prev, curr) => curr.boundingClientRect.bottom > prev.boundingClientRect.bottom ? curr : prev
74
+ );
75
+ case "left":
76
+ return entries.reduce(
77
+ (prev, curr) => curr.boundingClientRect.left < prev.boundingClientRect.left ? curr : prev
78
+ );
79
+ case "right":
80
+ return entries.reduce(
81
+ (prev, curr) => curr.boundingClientRect.right > prev.boundingClientRect.right ? curr : prev
82
+ );
83
+ default:
84
+ return entries[0];
85
+ }
86
+ },
87
+ []
88
+ );
89
+ const observerOptions = (0, import_react.useMemo)(
90
+ () => ({
91
+ root,
92
+ rootMargin,
93
+ threshold
94
+ }),
95
+ [root, rootMargin, threshold]
96
+ );
97
+ const createObserver = (0, import_react.useCallback)(() => {
98
+ if (typeof window !== "undefined" && !window.IntersectionObserver) {
99
+ console.warn("IntersectionObserver is not supported in this browser");
100
+ return null;
101
+ }
102
+ return new IntersectionObserver((entries) => {
103
+ if (entries.length === 0) return;
104
+ try {
105
+ if (!priorityMode) {
106
+ entries.forEach((entry) => {
107
+ const callback = findCallback(entry.target);
108
+ if (callback) {
109
+ callback(entry);
110
+ }
111
+ });
112
+ return;
113
+ }
114
+ const visibleEntries = [];
115
+ const invisibleEntries = [];
116
+ entries.forEach((entry) => {
117
+ if (entry.isIntersecting) {
118
+ visibleEntries.push(entry);
119
+ } else {
120
+ invisibleEntries.push(entry);
121
+ }
122
+ });
123
+ invisibleEntries.forEach((entry) => {
124
+ const callback = findCallback(entry.target);
125
+ if (callback) {
126
+ callback(entry);
127
+ }
128
+ });
129
+ if (visibleEntries.length > 0) {
130
+ const selectedEntry = selectPriorityEntry(
131
+ visibleEntries,
132
+ priorityMode
133
+ );
134
+ if (selectedEntry) {
135
+ const callback = findCallback(selectedEntry.target);
136
+ if (callback) {
137
+ callback(selectedEntry);
138
+ }
139
+ }
140
+ }
141
+ } catch (error) {
142
+ console.error("IntersectionObserver callback error:", error);
143
+ }
144
+ }, observerOptions);
145
+ }, [observerOptions, priorityMode, findCallback, selectPriorityEntry]);
146
+ const register = (0, import_react.useCallback)(
147
+ ({
148
+ ref,
149
+ callback
150
+ }) => {
151
+ if ((ref == null ? void 0 : ref.current) && (observerRef == null ? void 0 : observerRef.current)) {
152
+ const element = ref.current;
153
+ if (callbackMapRef.current.has(element)) {
154
+ return;
155
+ }
156
+ callbackMapRef.current.set(element, callback);
157
+ observerRef.current.observe(element);
158
+ }
159
+ },
160
+ []
161
+ );
162
+ const unregister = (0, import_react.useCallback)(
163
+ ({ ref }) => {
164
+ if ((ref == null ? void 0 : ref.current) && (observerRef == null ? void 0 : observerRef.current)) {
165
+ const element = ref.current;
166
+ callbackMapRef.current.delete(element);
167
+ observerRef.current.unobserve(element);
168
+ }
169
+ },
170
+ []
171
+ );
172
+ (0, import_react.useEffect)(() => {
173
+ if (mounted) {
174
+ if (observerRef.current) {
175
+ observerRef.current.disconnect();
176
+ }
177
+ observerRef.current = createObserver();
178
+ setInitialized(true);
179
+ }
180
+ }, [mounted, createObserver]);
181
+ (0, import_react.useEffect)(() => {
182
+ setMounted(true);
183
+ return () => {
184
+ if (observerRef.current) {
185
+ observerRef.current.disconnect();
186
+ callbackMapRef.current.clear();
187
+ setInitialized(false);
188
+ }
189
+ };
190
+ }, []);
191
+ const contextValue = {
192
+ initialized,
193
+ register,
194
+ unregister
195
+ };
196
+ return /* @__PURE__ */ import_react.default.createElement(Provider, { value: contextValue }, children);
197
+ };
198
+ var useIntersectionTrigger = (elementRef, options = {}) => {
199
+ const { once = false, onHide, onShow } = options;
200
+ const { initialized, register, unregister } = (0, import_react.useContext)(
201
+ IntersectionObserverContext
202
+ );
203
+ const [isIntersecting, setIsIntersecting] = (0, import_react.useState)(false);
204
+ const cleanup = (0, import_react.useCallback)(
205
+ () => unregister({ ref: elementRef }),
206
+ [elementRef, unregister]
207
+ );
208
+ const intersectionCallback = (0, import_react.useCallback)(
209
+ (entry) => {
210
+ if (entry.isIntersecting) {
211
+ onShow == null ? void 0 : onShow(cleanup);
212
+ if (once) {
213
+ unregister({ ref: elementRef });
214
+ }
215
+ } else {
216
+ onHide == null ? void 0 : onHide(cleanup);
217
+ }
218
+ setIsIntersecting(entry.isIntersecting);
219
+ },
220
+ [onShow, onHide, once, cleanup, unregister, elementRef]
221
+ );
222
+ const registerRef = (0, import_react.useRef)();
223
+ registerRef.current = () => {
224
+ return register({
225
+ ref: elementRef,
226
+ callback: intersectionCallback
227
+ });
228
+ };
229
+ (0, import_react.useEffect)(() => {
230
+ var _a;
231
+ if (initialized) {
232
+ (_a = registerRef.current) == null ? void 0 : _a.call(registerRef);
233
+ }
234
+ return () => {
235
+ cleanup();
236
+ };
237
+ }, [initialized, cleanup]);
238
+ return { isIntersecting };
239
+ };
240
+ var IntersectionTrigger = ({
241
+ children,
242
+ className,
243
+ style = {},
244
+ ...options
245
+ }) => {
246
+ const elementRef = (0, import_react.useRef)(null);
247
+ const { isIntersecting } = useIntersectionTrigger(elementRef, options);
248
+ return /* @__PURE__ */ import_react.default.createElement(
249
+ "div",
250
+ {
251
+ className,
252
+ ref: elementRef,
253
+ style: {
254
+ width: "100%",
255
+ height: "100%",
256
+ ...style
257
+ }
258
+ },
259
+ children
260
+ );
261
+ };
262
+ var IntersectionObserver_default = IntersectionObserverProvider;
263
+ // Annotate the CommonJS export names for ESM import in node:
264
+ 0 && (module.exports = {
265
+ IntersectionObserverConsumer,
266
+ IntersectionObserverContext,
267
+ IntersectionObserverProvider,
268
+ IntersectionTrigger
269
+ });
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import type { TabsStructureProps, TabListContainerProps, TabItemProps, RailProps, SelectionIndicatorProps, ScrollShadowProps, ChevronControlsProps, ChevronButtonProps } from './types';
3
+ declare global {
4
+ interface WeakRef<T extends object> {
5
+ deref(): T | undefined;
6
+ }
7
+ interface WeakRefConstructor {
8
+ new <T extends object>(target: T): WeakRef<T>;
9
+ }
10
+ const WeakRef: WeakRefConstructor | undefined;
11
+ }
12
+ declare const TabListContainer: React.ForwardRefExoticComponent<Omit<TabListContainerProps, "ref"> & React.RefAttributes<HTMLUListElement>>;
13
+ declare const TabItem: React.ForwardRefExoticComponent<Omit<TabItemProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
14
+ declare const Rail: React.ForwardRefExoticComponent<Omit<RailProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
+ declare const SelectionIndicator: React.ForwardRefExoticComponent<Omit<SelectionIndicatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
+ declare const ScrollShadow: React.ForwardRefExoticComponent<Omit<ScrollShadowProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
17
+ declare const ChevronButton: React.ForwardRefExoticComponent<Omit<ChevronButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
18
+ declare const ChevronControls: React.FC<ChevronControlsProps>;
19
+ declare type TabsStructureComponent = React.FC<TabsStructureProps> & {
20
+ Rail: typeof Rail;
21
+ ListContainer: typeof TabListContainer;
22
+ Item: typeof TabItem;
23
+ SelectionIndicator: typeof SelectionIndicator;
24
+ ScrollShadow: typeof ScrollShadow;
25
+ ChevronControls: typeof ChevronControls;
26
+ ChevronButton: typeof ChevronButton;
27
+ };
28
+ declare const TabsStructureWithSubComponents: TabsStructureComponent;
29
+ export default TabsStructureWithSubComponents;
30
+ export { TabListContainer, TabItem, Rail, SelectionIndicator, ScrollShadow, ChevronControls, ChevronButton, };
@@ -0,0 +1,393 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/plus/productSelect/components/TabsStructure/TabsStructure.tsx
30
+ var TabsStructure_exports = {};
31
+ __export(TabsStructure_exports, {
32
+ ChevronButton: () => ChevronButton,
33
+ ChevronControls: () => ChevronControls,
34
+ Rail: () => Rail,
35
+ ScrollShadow: () => ScrollShadow,
36
+ SelectionIndicator: () => SelectionIndicator,
37
+ TabItem: () => TabItem,
38
+ TabListContainer: () => TabListContainer,
39
+ default: () => TabsStructure_default
40
+ });
41
+ module.exports = __toCommonJS(TabsStructure_exports);
42
+ var import_react = __toESM(require("react"));
43
+ var import_classnames = __toESM(require("classnames"));
44
+ var import_styles = require("./styles");
45
+ var import_utils = require("./utils");
46
+ var import_ChevronLeft = __toESM(require("@pisell/icon/es/ChevronLeft"));
47
+ var import_ChevronRight = __toESM(require("@pisell/icon/es/ChevronRight"));
48
+ var TabContext = (0, import_react.createContext)({});
49
+ var useTabContext = () => {
50
+ const context = (0, import_react.useContext)(TabContext);
51
+ if (!context) {
52
+ throw new Error("useTabContext must be used within a TabContext.Provider");
53
+ }
54
+ return context;
55
+ };
56
+ var TabListContainer = (0, import_react.forwardRef)(
57
+ ({ children, className, ...props }, ref) => {
58
+ return /* @__PURE__ */ import_react.default.createElement(
59
+ "ul",
60
+ {
61
+ ref,
62
+ className: (0, import_classnames.default)(import_styles.tabListClasses.list, className),
63
+ role: "tablist",
64
+ ...props
65
+ },
66
+ children
67
+ );
68
+ }
69
+ );
70
+ var TabItem = (0, import_react.forwardRef)(
71
+ ({
72
+ children,
73
+ isSelected = false,
74
+ isDisabled = false,
75
+ className,
76
+ onClick,
77
+ tabId,
78
+ autoRegister = true,
79
+ ...props
80
+ }, ref) => {
81
+ const { selectedTab, onTabChange, registerTab, unregisterTab } = useTabContext();
82
+ const elementRef = (0, import_react.useRef)(null);
83
+ const combinedRef = (0, import_react.useCallback)(
84
+ (element) => {
85
+ elementRef.current = element;
86
+ if (typeof ref === "function") {
87
+ ref(element);
88
+ } else if (ref && "current" in ref) {
89
+ ref.current = element;
90
+ }
91
+ },
92
+ [ref]
93
+ );
94
+ (0, import_react.useEffect)(() => {
95
+ if (autoRegister && tabId && elementRef.current && registerTab) {
96
+ registerTab(tabId, elementRef.current);
97
+ return () => {
98
+ if (unregisterTab) {
99
+ unregisterTab(tabId);
100
+ }
101
+ };
102
+ }
103
+ }, [tabId, autoRegister, registerTab, unregisterTab]);
104
+ const handleClick = (0, import_react.useCallback)(() => {
105
+ if (!isDisabled) {
106
+ if (tabId && onTabChange) {
107
+ onTabChange(tabId);
108
+ }
109
+ onClick == null ? void 0 : onClick(tabId);
110
+ }
111
+ }, [isDisabled, tabId, onTabChange, onClick]);
112
+ const isTabSelected = tabId ? selectedTab === tabId : isSelected;
113
+ return /* @__PURE__ */ import_react.default.createElement("li", { role: "presentation", style: { lineHeight: 0 } }, /* @__PURE__ */ import_react.default.createElement(
114
+ "button",
115
+ {
116
+ id: tabId,
117
+ ref: combinedRef,
118
+ className: (0, import_classnames.default)(
119
+ import_styles.tabItemClasses.item,
120
+ isTabSelected && import_styles.tabItemClasses.selected,
121
+ isDisabled && import_styles.tabItemClasses.disabled,
122
+ className
123
+ ),
124
+ role: "tab",
125
+ "aria-selected": isTabSelected,
126
+ "aria-disabled": isDisabled,
127
+ disabled: isDisabled,
128
+ onClick: handleClick,
129
+ tabIndex: isTabSelected ? 0 : -1,
130
+ ...props
131
+ },
132
+ children
133
+ ));
134
+ }
135
+ );
136
+ var Rail = (0, import_react.forwardRef)(
137
+ ({ children, className, ...props }, ref) => {
138
+ const { railRef: contextRailRef } = useTabContext();
139
+ const mergedRef = (0, import_react.useCallback)(
140
+ (element) => {
141
+ if (contextRailRef && "current" in contextRailRef) {
142
+ contextRailRef.current = element;
143
+ }
144
+ if (typeof ref === "function") {
145
+ ref(element);
146
+ } else if (ref && "current" in ref) {
147
+ ref.current = element;
148
+ }
149
+ },
150
+ [ref, contextRailRef]
151
+ );
152
+ return /* @__PURE__ */ import_react.default.createElement(
153
+ "div",
154
+ {
155
+ ref: mergedRef,
156
+ className: (0, import_classnames.default)(import_styles.railClasses.rail, className),
157
+ ...props
158
+ },
159
+ children
160
+ );
161
+ }
162
+ );
163
+ var SelectionIndicator = (0, import_react.forwardRef)(
164
+ ({ focusRingClasses, isFocusVisible = false, style, className, ...props }, ref) => {
165
+ return /* @__PURE__ */ import_react.default.createElement(
166
+ "div",
167
+ {
168
+ ref,
169
+ className: (0, import_classnames.default)(
170
+ import_styles.selectionClasses.selection,
171
+ import_styles.selectionClasses.position,
172
+ {
173
+ [import_styles.selectionClasses.focused]: isFocusVisible && focusRingClasses
174
+ },
175
+ className
176
+ ),
177
+ style,
178
+ "aria-hidden": "true",
179
+ ...props
180
+ }
181
+ );
182
+ }
183
+ );
184
+ var ScrollShadow = (0, import_react.forwardRef)(
185
+ ({ visible, location, className, ...props }, ref) => {
186
+ return /* @__PURE__ */ import_react.default.createElement(
187
+ "div",
188
+ {
189
+ ref,
190
+ className: (0, import_classnames.default)(
191
+ import_styles.shadowClasses.shadow,
192
+ {
193
+ [import_styles.shadowClasses.isVisible]: visible,
194
+ [import_styles.shadowClasses.locationStart]: location === "start",
195
+ [import_styles.shadowClasses.locationEnd]: location === "end"
196
+ },
197
+ className
198
+ ),
199
+ ...props
200
+ }
201
+ );
202
+ }
203
+ );
204
+ var ChevronButton = (0, import_react.forwardRef)(
205
+ ({
206
+ direction,
207
+ disabled = false,
208
+ onClick,
209
+ className,
210
+ "aria-label": ariaLabel,
211
+ ...props
212
+ }, ref) => {
213
+ const defaultAriaLabel = direction === "prev" ? "prev" : "next";
214
+ return /* @__PURE__ */ import_react.default.createElement(
215
+ "button",
216
+ {
217
+ ref,
218
+ className: (0, import_classnames.default)(
219
+ import_styles.chevronButtonClasses.button,
220
+ {
221
+ [import_styles.chevronButtonClasses.disabled]: disabled,
222
+ [import_styles.chevronButtonClasses.prev]: direction === "prev",
223
+ [import_styles.chevronButtonClasses.next]: direction === "next"
224
+ },
225
+ className
226
+ ),
227
+ disabled,
228
+ onClick,
229
+ "aria-label": ariaLabel || defaultAriaLabel,
230
+ type: "button",
231
+ ...props
232
+ },
233
+ direction === "prev" ? /* @__PURE__ */ import_react.default.createElement(import_ChevronLeft.default, null) : /* @__PURE__ */ import_react.default.createElement(import_ChevronRight.default, null)
234
+ );
235
+ }
236
+ );
237
+ var ChevronControls = ({
238
+ isPrevDisabled = false,
239
+ isNextDisabled = false,
240
+ onPrevClick,
241
+ onNextClick,
242
+ prevAction,
243
+ nextAction,
244
+ className,
245
+ ...props
246
+ }) => {
247
+ const handlePrevClick = onPrevClick || prevAction;
248
+ const handleNextClick = onNextClick || nextAction;
249
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(import_styles.chevronClasses.controls, className), ...props }, /* @__PURE__ */ import_react.default.createElement(
250
+ ChevronButton,
251
+ {
252
+ direction: "prev",
253
+ disabled: isPrevDisabled,
254
+ onClick: handlePrevClick
255
+ }
256
+ ), /* @__PURE__ */ import_react.default.createElement(
257
+ ChevronButton,
258
+ {
259
+ direction: "next",
260
+ disabled: isNextDisabled,
261
+ onClick: handleNextClick
262
+ }
263
+ ));
264
+ };
265
+ var TabsStructure = ({
266
+ selectedTab,
267
+ onTabChange,
268
+ autoScrollToSelected = true,
269
+ children,
270
+ className,
271
+ railRef: externalRailRef,
272
+ ...props
273
+ }) => {
274
+ const tabElementsRef = (0, import_react.useRef)(/* @__PURE__ */ new Map());
275
+ const internalRailRef = (0, import_react.useRef)(null);
276
+ const railRef = externalRailRef || internalRailRef;
277
+ if (!selectedTab && children) {
278
+ console.warn("TabsStructure: No selectedTab provided, consider setting a default value");
279
+ }
280
+ const registerTab = (0, import_react.useCallback)((tabId, element) => {
281
+ if (!tabId || !element) {
282
+ console.warn("TabsStructure: Invalid tabId or element provided to registerTab");
283
+ return;
284
+ }
285
+ if (typeof WeakRef !== "undefined") {
286
+ tabElementsRef.current.set(tabId, new WeakRef(element));
287
+ } else {
288
+ tabElementsRef.current.set(tabId, element);
289
+ }
290
+ }, []);
291
+ const unregisterTab = (0, import_react.useCallback)((tabId) => {
292
+ if (tabId) {
293
+ tabElementsRef.current.delete(tabId);
294
+ }
295
+ }, []);
296
+ const clearAllTabs = (0, import_react.useCallback)(() => {
297
+ tabElementsRef.current.clear();
298
+ }, []);
299
+ (0, import_react.useEffect)(() => {
300
+ return () => {
301
+ if (typeof WeakRef === "undefined") {
302
+ clearAllTabs();
303
+ }
304
+ };
305
+ }, [clearAllTabs]);
306
+ const getTabElement = (0, import_react.useCallback)((tabId) => {
307
+ const ref = tabElementsRef.current.get(tabId);
308
+ if (!ref) return null;
309
+ if (typeof WeakRef !== "undefined" && ref instanceof WeakRef) {
310
+ const element = ref.deref();
311
+ if (!element) {
312
+ tabElementsRef.current.delete(tabId);
313
+ return null;
314
+ }
315
+ return element;
316
+ } else {
317
+ return ref;
318
+ }
319
+ }, []);
320
+ const scrollToTab = (0, import_react.useCallback)((tabId) => {
321
+ if (!tabId || !railRef.current) {
322
+ return;
323
+ }
324
+ const targetElement = getTabElement(tabId);
325
+ if (!targetElement) {
326
+ console.warn(`TabsStructure: Tab element with id "${tabId}" not found`);
327
+ return;
328
+ }
329
+ if (!targetElement.offsetParent) {
330
+ console.warn(`TabsStructure: Tab element "${tabId}" is not visible or not in DOM`);
331
+ return;
332
+ }
333
+ const rail = railRef.current;
334
+ const targetLeft = targetElement.offsetLeft;
335
+ const currentScrollLeft = rail.scrollLeft;
336
+ if (Math.abs(targetLeft - currentScrollLeft) > 1) {
337
+ (0, import_utils.safeScrollTo)(rail, {
338
+ left: targetLeft,
339
+ behavior: "smooth"
340
+ });
341
+ }
342
+ }, [getTabElement]);
343
+ (0, import_react.useEffect)(() => {
344
+ if (autoScrollToSelected && selectedTab) {
345
+ scrollToTab(selectedTab);
346
+ }
347
+ }, [selectedTab, autoScrollToSelected, scrollToTab]);
348
+ const contextValue = (0, import_react.useMemo)(
349
+ () => ({
350
+ selectedTab,
351
+ onTabChange,
352
+ registerTab,
353
+ unregisterTab,
354
+ railRef
355
+ }),
356
+ [selectedTab, onTabChange, registerTab, unregisterTab, railRef]
357
+ );
358
+ return /* @__PURE__ */ import_react.default.createElement(TabContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react.default.createElement(
359
+ "div",
360
+ {
361
+ ...props,
362
+ className: (0, import_classnames.default)(import_styles.tabWrapperClasses.wrapper, className)
363
+ },
364
+ children
365
+ ));
366
+ };
367
+ var TabsStructureWithSubComponents = TabsStructure;
368
+ TabsStructureWithSubComponents.Rail = Rail;
369
+ TabsStructureWithSubComponents.ListContainer = TabListContainer;
370
+ TabsStructureWithSubComponents.Item = TabItem;
371
+ TabsStructureWithSubComponents.SelectionIndicator = SelectionIndicator;
372
+ TabsStructureWithSubComponents.ScrollShadow = ScrollShadow;
373
+ TabsStructureWithSubComponents.ChevronControls = ChevronControls;
374
+ TabsStructureWithSubComponents.ChevronButton = ChevronButton;
375
+ TabsStructure.displayName = "TabsStructure";
376
+ Rail.displayName = "TabsStructure.Rail";
377
+ TabListContainer.displayName = "TabsStructure.ListContainer";
378
+ TabItem.displayName = "TabsStructure.Item";
379
+ SelectionIndicator.displayName = "TabsStructure.SelectionIndicator";
380
+ ScrollShadow.displayName = "TabsStructure.ScrollShadow";
381
+ ChevronControls.displayName = "TabsStructure.ChevronControls";
382
+ ChevronButton.displayName = "TabsStructure.ChevronButton";
383
+ var TabsStructure_default = TabsStructureWithSubComponents;
384
+ // Annotate the CommonJS export names for ESM import in node:
385
+ 0 && (module.exports = {
386
+ ChevronButton,
387
+ ChevronControls,
388
+ Rail,
389
+ ScrollShadow,
390
+ SelectionIndicator,
391
+ TabItem,
392
+ TabListContainer
393
+ });