@edifice.io/react 2.6.11-develop-b2school.20261029150712 → 2.6.11-develop-b2school.20261029162931
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.
- package/dist/components/Masonry/Masonry.d.ts +40 -0
- package/dist/components/Masonry/Masonry.js +50 -0
- package/dist/components/Masonry/index.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.js +18 -1
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.js +5 -4
- package/package.json +6 -6
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface MasonryItemProps {
|
|
3
|
+
/**
|
|
4
|
+
* Number of columns the item spans (capped to the number of columns).
|
|
5
|
+
* @default 1
|
|
6
|
+
*/
|
|
7
|
+
span?: number;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export interface MasonryProps extends HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
/**
|
|
12
|
+
* Items to lay out. Each child is one masonry item, in reading order.
|
|
13
|
+
*/
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Number of columns. Each column takes an equal share of the available
|
|
17
|
+
* width, gap excluded.
|
|
18
|
+
* @default 2
|
|
19
|
+
*/
|
|
20
|
+
columns?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Gap between columns and between items, as a spacing token (e.g. `16`).
|
|
23
|
+
* @default '16'
|
|
24
|
+
*/
|
|
25
|
+
gap?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Optional class for styling purpose
|
|
28
|
+
*/
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const Masonry: {
|
|
32
|
+
({ children, columns, gap, className, style, ...restProps }: MasonryProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
displayName: string;
|
|
34
|
+
} & {
|
|
35
|
+
Item: {
|
|
36
|
+
({ children }: MasonryItemProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
displayName: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export default Masonry;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState, Children, useCallback, useLayoutEffect, isValidElement } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
const MasonryItem = ({
|
|
5
|
+
children
|
|
6
|
+
}) => /* @__PURE__ */ jsx(Fragment, { children }), Root = ({
|
|
7
|
+
children,
|
|
8
|
+
columns = 2,
|
|
9
|
+
gap = "16",
|
|
10
|
+
className,
|
|
11
|
+
style,
|
|
12
|
+
...restProps
|
|
13
|
+
}) => {
|
|
14
|
+
const columnCount = Math.max(1, Math.floor(columns)), gridRef = useRef(null), itemRefs = useRef(/* @__PURE__ */ new Map()), [spans, setSpans] = useState({}), items = Children.toArray(children), measure = useCallback(() => {
|
|
15
|
+
const grid = gridRef.current;
|
|
16
|
+
if (!grid) return;
|
|
17
|
+
const rowGap = parseFloat(getComputedStyle(grid).columnGap) || 0, next = {};
|
|
18
|
+
itemRefs.current.forEach((el, key) => {
|
|
19
|
+
next[key] = Math.ceil(el.getBoundingClientRect().height + rowGap);
|
|
20
|
+
}), setSpans((prev) => {
|
|
21
|
+
const keys = Object.keys(next);
|
|
22
|
+
return keys.length === Object.keys(prev).length && keys.every((key) => prev[key] === next[key]) ? prev : next;
|
|
23
|
+
});
|
|
24
|
+
}, []);
|
|
25
|
+
return useLayoutEffect(() => {
|
|
26
|
+
if (measure(), typeof ResizeObserver > "u") return;
|
|
27
|
+
const observer = new ResizeObserver(measure);
|
|
28
|
+
return gridRef.current && observer.observe(gridRef.current), itemRefs.current.forEach((el) => observer.observe(el)), () => observer.disconnect();
|
|
29
|
+
}, [measure, columnCount, items.length]), /* @__PURE__ */ jsx("div", { ref: gridRef, className: clsx("masonry", `column-gap-${gap}`, className), style: {
|
|
30
|
+
display: "grid",
|
|
31
|
+
gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`,
|
|
32
|
+
gridAutoRows: "1px",
|
|
33
|
+
alignItems: "start",
|
|
34
|
+
...style
|
|
35
|
+
}, ...restProps, children: items.map((item, index) => {
|
|
36
|
+
const key = String(item.key ?? index), span = /* @__PURE__ */ isValidElement(item) && item.type === MasonryItem ? Math.min(Math.max(1, Math.floor(item.props.span ?? 1)), columnCount) : 1;
|
|
37
|
+
return /* @__PURE__ */ jsx("div", { ref: (el) => {
|
|
38
|
+
el ? itemRefs.current.set(key, el) : itemRefs.current.delete(key);
|
|
39
|
+
}, className: "masonry__item", "data-testid": `masonry-item-${index}`, style: {
|
|
40
|
+
gridColumn: `span ${span}`,
|
|
41
|
+
gridRowEnd: `span ${spans[key] ?? 1}`
|
|
42
|
+
}, children: item }, key);
|
|
43
|
+
}) });
|
|
44
|
+
}, Masonry = Object.assign(Root, {
|
|
45
|
+
Item: MasonryItem
|
|
46
|
+
});
|
|
47
|
+
export {
|
|
48
|
+
Masonry,
|
|
49
|
+
Masonry as default
|
|
50
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ import { default as default40 } from "./components/Loading/Loading.js";
|
|
|
42
42
|
import { default as default41 } from "./components/LoadingScreen/LoadingScreen.js";
|
|
43
43
|
import { default as default42 } from "./components/Logo/Logo.js";
|
|
44
44
|
import { default as default43 } from "./components/LogoBeta/LogoBeta.js";
|
|
45
|
+
import { Masonry } from "./components/Masonry/Masonry.js";
|
|
45
46
|
import { default as default44 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
|
|
46
47
|
import { default as default45 } from "./components/MediaViewer/MediaViewer.js";
|
|
47
48
|
import { default as default46 } from "./components/Modal/Modal.js";
|
|
@@ -230,6 +231,7 @@ export {
|
|
|
230
231
|
default41 as LoadingScreen,
|
|
231
232
|
default42 as Logo,
|
|
232
233
|
default43 as LogoBeta,
|
|
234
|
+
Masonry,
|
|
233
235
|
default44 as MediaLibrary,
|
|
234
236
|
default45 as MediaViewer,
|
|
235
237
|
Menu,
|
|
@@ -35,7 +35,24 @@ function GenerationHdf({
|
|
|
35
35
|
] }) : /* @__PURE__ */ jsx("p", { className: "generation-hdf__description", children: t("homepage.widget.generation-hdf.description") }),
|
|
36
36
|
/* @__PURE__ */ jsxs("form", { className: "generation-hdf__form", onSubmit, children: [
|
|
37
37
|
/* @__PURE__ */ jsxs(FormControl, { id: "generationHdfCardNumber", className: "generation-hdf__field", status: isError ? "invalid" : void 0, children: [
|
|
38
|
-
/* @__PURE__ */ jsx(
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
Input,
|
|
40
|
+
{
|
|
41
|
+
size: "md",
|
|
42
|
+
type: "text",
|
|
43
|
+
inputMode: "numeric",
|
|
44
|
+
placeholder: t("homepage.widget.generation-hdf.placeholder"),
|
|
45
|
+
value: cardNumber,
|
|
46
|
+
onChangeCapture: (event) => {
|
|
47
|
+
event.currentTarget.value = event.currentTarget.value.replace(/\D/g, "");
|
|
48
|
+
},
|
|
49
|
+
onChange: (event) => onCardNumberChange(event.target.value),
|
|
50
|
+
disabled: isAccount,
|
|
51
|
+
maxLength: 12,
|
|
52
|
+
showCounter: !0
|
|
53
|
+
},
|
|
54
|
+
isAccount ? "account" : "form"
|
|
55
|
+
),
|
|
39
56
|
isError && /* @__PURE__ */ jsx(FormControl.Text, { children: t("homepage.widget.generation-hdf.error") })
|
|
40
57
|
] }),
|
|
41
58
|
isAccount ? /* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "outline", color: "default", onClick: onEdit, children: t("homepage.widget.generation-hdf.edit") }) : /* @__PURE__ */ jsx(ButtonBeta, { type: "submit", variant: "outline", color: "default", isLoading, disabled: !cardNumber.trim(), children: t("homepage.widget.generation-hdf.submit") })
|
|
@@ -38,15 +38,16 @@ function useGenerationHdf() {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
useEffect(() => {
|
|
41
|
-
|
|
41
|
+
var _a;
|
|
42
|
+
if (autoLoadTriggered.current || !preferenceQuery.isSuccess) return;
|
|
42
43
|
autoLoadTriggered.current = !0;
|
|
43
|
-
const storedCardNb = preferenceQuery.data.cardNb;
|
|
44
|
+
const storedCardNb = (_a = preferenceQuery.data) == null ? void 0 : _a.cardNb;
|
|
44
45
|
storedCardNb && (setCardNumber(storedCardNb), salesMutation.mutate({
|
|
45
46
|
cardNb: storedCardNb,
|
|
46
47
|
persist: !1
|
|
47
48
|
}));
|
|
48
|
-
}, [preferenceQuery.data, salesMutation]);
|
|
49
|
-
const status = preferenceQuery.
|
|
49
|
+
}, [preferenceQuery.isSuccess, preferenceQuery.data, salesMutation]);
|
|
50
|
+
const status = preferenceQuery.isPending || salesMutation.isPending ? "loading" : salesMutation.isError ? "error" : salesMutation.isSuccess ? "account" : "idle", wallets = salesMutation.data ? mapSalesToWallets(salesMutation.data) : [];
|
|
50
51
|
return {
|
|
51
52
|
status,
|
|
52
53
|
cardNumber,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.6.11-develop-b2school.
|
|
3
|
+
"version": "2.6.11-develop-b2school.20261029162931",
|
|
4
4
|
"description": "Edifice React Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -140,9 +140,9 @@
|
|
|
140
140
|
"swiper": "10.1.0",
|
|
141
141
|
"ua-parser-js": "1.0.36",
|
|
142
142
|
"zustand": "4.5.7",
|
|
143
|
-
"@edifice.io/
|
|
144
|
-
"@edifice.io/tiptap-extensions": "2.6.11-develop-b2school.
|
|
145
|
-
"@edifice.io/
|
|
143
|
+
"@edifice.io/utilities": "2.6.11-develop-b2school.20261029162931",
|
|
144
|
+
"@edifice.io/tiptap-extensions": "2.6.11-develop-b2school.20261029162931",
|
|
145
|
+
"@edifice.io/bootstrap": "2.6.11-develop-b2school.20261029162931"
|
|
146
146
|
},
|
|
147
147
|
"devDependencies": {
|
|
148
148
|
"@babel/plugin-transform-react-pure-annotations": "7.27.1",
|
|
@@ -174,8 +174,8 @@
|
|
|
174
174
|
"vite": "5.4.14",
|
|
175
175
|
"vite-plugin-dts": "4.5.4",
|
|
176
176
|
"vite-tsconfig-paths": "5.1.4",
|
|
177
|
-
"@edifice.io/client": "2.6.11-develop-b2school.
|
|
178
|
-
"@edifice.io/config": "2.6.11-develop-b2school.
|
|
177
|
+
"@edifice.io/client": "2.6.11-develop-b2school.20261029162931",
|
|
178
|
+
"@edifice.io/config": "2.6.11-develop-b2school.20261029162931"
|
|
179
179
|
},
|
|
180
180
|
"peerDependencies": {
|
|
181
181
|
"@react-spring/web": "9.7.5",
|