layers-select-control 0.2.0 → 0.3.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayersSelectControl.d.ts","sourceRoot":"","sources":["../src/LayersSelectControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,MAAM,WAAW,SAAS;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,KAAK;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,KAAK,EAAE,SAAS,EAAE,CAAC;IAEnB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAExB,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GA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IAEzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAkED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA0Q/C,CAAC"}
|
|
@@ -47,7 +47,7 @@ function ManagedImage({ candidates, initial, alt, className, expanded, noImageTh
|
|
|
47
47
|
// ------------------------------------------------------
|
|
48
48
|
// COMPONENT (LOGIC PRESERVED)
|
|
49
49
|
// ------------------------------------------------------
|
|
50
|
-
const LayersSelectControl = ({ items, value, defaultValue, x = 8, y = 32, xRel = "left", yRel = "bottom", defaultItem, onSelect, onMore, onDefault, maxVisible = DEFAULT_MAX_VISIBLE, hoverCloseDelayMs = 160, theme = "dark", defaultThumb = DEFAULT_RESET_IMAGE_URL, noImageThumb = DEFAULT_NO_IMAGE_URL, moreThumb = DEFAULT_IMAGE_MORE, size = "small", panelGap = 8, parentGap = 8, onCollapse, onExpand }) => {
|
|
50
|
+
const LayersSelectControl = ({ items, value, defaultValue, x = 8, y = 32, xRel = "left", yRel = "bottom", defaultItem, moreItem, onSelect, onMore, onDefault, maxVisible = DEFAULT_MAX_VISIBLE, hoverCloseDelayMs = 160, theme = "dark", defaultThumb = DEFAULT_RESET_IMAGE_URL, noImageThumb = DEFAULT_NO_IMAGE_URL, moreThumb = DEFAULT_IMAGE_MORE, size = "small", panelGap = 8, parentGap = 8, onCollapse, onExpand }) => {
|
|
51
51
|
const isControlled = value !== undefined;
|
|
52
52
|
const [internalValue, setInternalValue] = (0, react_1.useState)(defaultValue);
|
|
53
53
|
const selectedId = isControlled ? value : internalValue;
|
|
@@ -178,13 +178,13 @@ const LayersSelectControl = ({ items, value, defaultValue, x = 8, y = 32, xRel =
|
|
|
178
178
|
setSelectedId(defaultItem.id);
|
|
179
179
|
onDefault(defaultItem);
|
|
180
180
|
setExpanded(false);
|
|
181
|
-
}, children: [(0, jsx_runtime_1.jsx)(ManagedImage, { candidates: [defaultThumb], initial: defaultThumb, expanded: expanded, className: "lsc-t-thumb", noImageThumb: noImageThumb }), (0, jsx_runtime_1.jsx)("div", { className: "lsc-title", children: "Default" }), (0, jsx_runtime_1.jsx)("div", { className: "lsc-desc", children: "
|
|
181
|
+
}, children: [(0, jsx_runtime_1.jsx)(ManagedImage, { candidates: [defaultThumb], initial: defaultThumb, expanded: expanded, className: "lsc-t-thumb", noImageThumb: noImageThumb }), (0, jsx_runtime_1.jsx)("div", { className: "lsc-title", children: defaultItem.title ? defaultItem.title : "Default" }), (0, jsx_runtime_1.jsx)("div", { className: "lsc-desc", children: defaultItem.description ? defaultItem.description : "Default Content" })] })), (0, jsx_runtime_1.jsxs)("div", { className: "lsc-scroll-wrap", children: [canScrollLeft && ((0, jsx_runtime_1.jsx)("div", { className: "lsc-arrow lsc-arrow-left", onClick: () => scrollBy(-1), children: "\u276E" })), (0, jsx_runtime_1.jsx)("div", { className: "lsc-tiles-wrap", ref: scrollRef, children: (0, jsx_runtime_1.jsx)("div", { className: "lsc-tiles", children: visibleItems.map((item) => ((0, jsx_runtime_1.jsxs)("div", { className: "lsc-tile", onClick: () => {
|
|
182
182
|
setSelectedId(item.id);
|
|
183
183
|
onSelect(item);
|
|
184
184
|
setTimeout(() => setExpanded(false), 10);
|
|
185
185
|
}, children: [(0, jsx_runtime_1.jsx)(ManagedImage, { candidates: expandedCandidates(item), initial: collapsedThumb(item), expanded: expanded, className: "lsc-t-thumb", noImageThumb: noImageThumb }), (0, jsx_runtime_1.jsx)("div", { className: "lsc-title", children: item.title }), (0, jsx_runtime_1.jsx)("div", { className: "lsc-desc", children: item.description })] }, item.id))) }) }), canScrollRight && ((0, jsx_runtime_1.jsx)("div", { className: "lsc-arrow lsc-arrow-right", onClick: () => scrollBy(1), children: "\u276F" }))] }), showMore && ((0, jsx_runtime_1.jsxs)("div", { className: "lsc-tile", onClick: () => {
|
|
186
186
|
onMore === null || onMore === void 0 ? void 0 : onMore();
|
|
187
187
|
setExpanded(false);
|
|
188
|
-
}, children: [(0, jsx_runtime_1.jsx)(ManagedImage, { candidates: [moreThumb], initial: moreThumb, expanded: expanded, className: "lsc-t-thumb", noImageThumb: noImageThumb }), (0, jsx_runtime_1.jsx)("div", { className: "lsc-title", children: "More
|
|
188
|
+
}, children: [(0, jsx_runtime_1.jsx)(ManagedImage, { candidates: [moreThumb], initial: moreThumb, expanded: expanded, className: "lsc-t-thumb", noImageThumb: noImageThumb }), (0, jsx_runtime_1.jsx)("div", { className: "lsc-title", children: (moreItem === null || moreItem === void 0 ? void 0 : moreItem.title) ? moreItem === null || moreItem === void 0 ? void 0 : moreItem.title : "More…" }), (0, jsx_runtime_1.jsx)("div", { className: "lsc-desc", children: (moreItem === null || moreItem === void 0 ? void 0 : moreItem.description) ? moreItem === null || moreItem === void 0 ? void 0 : moreItem.description : "Show all" })] }))] }) })] }));
|
|
189
189
|
};
|
|
190
190
|
exports.LayersSelectControl = LayersSelectControl;
|