@digital-b2c/coreui-kit 0.17.1 → 0.17.3
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/LICENSE.txt +21 -21
- package/README.md +52 -52
- package/dist/index.cjs +22 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +25 -3
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +1 -4
- package/dist/index.d.ts +1 -4
- package/dist/index.mjs +23 -7
- package/dist/index.mjs.map +1 -1
- package/dist/types/global.d.ts +25 -25
- package/package.json +101 -100
package/dist/index.d.cts
CHANGED
|
@@ -275,11 +275,8 @@ declare const PracticeCard: ({ className, title, cta, image }: PracticeCardProps
|
|
|
275
275
|
|
|
276
276
|
interface SidebarCategory {
|
|
277
277
|
label: string;
|
|
278
|
-
/**
|
|
279
|
-
* Value matched against `ResourceItem.category` to filter items.
|
|
280
|
-
* Omit it (e.g. an "All Resources" entry) to show every item.
|
|
281
|
-
*/
|
|
282
278
|
value?: string;
|
|
279
|
+
extension?: string;
|
|
283
280
|
active?: boolean;
|
|
284
281
|
hasNotification?: boolean;
|
|
285
282
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -275,11 +275,8 @@ declare const PracticeCard: ({ className, title, cta, image }: PracticeCardProps
|
|
|
275
275
|
|
|
276
276
|
interface SidebarCategory {
|
|
277
277
|
label: string;
|
|
278
|
-
/**
|
|
279
|
-
* Value matched against `ResourceItem.category` to filter items.
|
|
280
|
-
* Omit it (e.g. an "All Resources" entry) to show every item.
|
|
281
|
-
*/
|
|
282
278
|
value?: string;
|
|
279
|
+
extension?: string;
|
|
283
280
|
active?: boolean;
|
|
284
281
|
hasNotification?: boolean;
|
|
285
282
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import clsx49 from 'clsx';
|
|
2
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import React71, { forwardRef, useId, useRef, useState, useCallback, useMemo, useEffect, Children, isValidElement, Fragment as Fragment$1 } from 'react';
|
|
3
|
+
import React71, { forwardRef, useId, useRef, useState, useCallback, useMemo, useEffect, Children, isValidElement, Fragment as Fragment$1, useSyncExternalStore } from 'react';
|
|
4
4
|
import gsap$1, { gsap } from 'gsap';
|
|
5
5
|
import { useGSAP } from '@gsap/react';
|
|
6
6
|
import { ScrollTrigger } from 'gsap/ScrollTrigger';
|
|
@@ -4572,6 +4572,16 @@ var ResourcesGridList_module_default = {
|
|
|
4572
4572
|
notificationDot: "ResourcesGridList_module_notificationDot"
|
|
4573
4573
|
};
|
|
4574
4574
|
var ITEMS_PER_PAGE = 12;
|
|
4575
|
+
var getCategorySlug = (cat) => {
|
|
4576
|
+
var _a;
|
|
4577
|
+
return (cat == null ? void 0 : cat.extension) || ((_a = cat == null ? void 0 : cat.label) == null ? void 0 : _a.replaceAll(" ", "-").toLocaleLowerCase());
|
|
4578
|
+
};
|
|
4579
|
+
var subscribeHash = (onStoreChange) => {
|
|
4580
|
+
window.addEventListener("hashchange", onStoreChange);
|
|
4581
|
+
return () => window.removeEventListener("hashchange", onStoreChange);
|
|
4582
|
+
};
|
|
4583
|
+
var getHashSnapshot = () => window.location.hash;
|
|
4584
|
+
var getServerHashSnapshot = () => "";
|
|
4575
4585
|
var ResourcesGridList = ({
|
|
4576
4586
|
className,
|
|
4577
4587
|
items = [],
|
|
@@ -4587,22 +4597,28 @@ var ResourcesGridList = ({
|
|
|
4587
4597
|
const [sortValue, setSortValue] = useState(defaultSort);
|
|
4588
4598
|
const [searchQuery, setSearchQuery] = useState("");
|
|
4589
4599
|
const [currentPage, setCurrentPage] = useState(1);
|
|
4590
|
-
const [selectedCategory, setSelectedCategory] = useState(() => {
|
|
4591
|
-
const activeIndex = categories.findIndex((cat) => cat.active);
|
|
4592
|
-
return activeIndex === -1 ? 0 : activeIndex;
|
|
4593
|
-
});
|
|
4594
4600
|
const widgetRef = useRef(null);
|
|
4595
4601
|
const { is } = useViewPort_default();
|
|
4596
4602
|
const isMobile = is("tablet", "below");
|
|
4603
|
+
const currentHash = useSyncExternalStore(subscribeHash, getHashSnapshot, getServerHashSnapshot);
|
|
4604
|
+
const selectedCategory = (() => {
|
|
4605
|
+
const hash = decodeURIComponent(currentHash.replace(/^#/, ""));
|
|
4606
|
+
if (hash) {
|
|
4607
|
+
const hashIndex = categories.findIndex((cat) => getCategorySlug(cat) === hash);
|
|
4608
|
+
if (hashIndex !== -1) return hashIndex;
|
|
4609
|
+
}
|
|
4610
|
+
const activeIndex = categories.findIndex((cat) => cat.active);
|
|
4611
|
+
return activeIndex === -1 ? 0 : activeIndex;
|
|
4612
|
+
})();
|
|
4597
4613
|
const selectedValue = (_a = categories[selectedCategory]) == null ? void 0 : _a.value;
|
|
4598
4614
|
const handleSelectCategory = (index) => {
|
|
4599
4615
|
var _a2, _b;
|
|
4600
|
-
setSelectedCategory(index);
|
|
4601
4616
|
setCurrentPage(1);
|
|
4602
4617
|
const categoryText = (_b = (_a2 = categories[index]) == null ? void 0 : _a2.label) == null ? void 0 : _b.replaceAll(" ", "-");
|
|
4618
|
+
const slug = getCategorySlug(categories[index]);
|
|
4603
4619
|
if (typeof window !== "undefined" && categoryText) {
|
|
4604
4620
|
const base_url = window.location.pathname.endsWith("/") ? window.location.pathname.slice(0, -1) : window.location.pathname;
|
|
4605
|
-
const url = categoryText !== "All-Resources" ? `${base_url}
|
|
4621
|
+
const url = categoryText !== "All-Resources" ? `${base_url}/#${slug}` : `${base_url}`;
|
|
4606
4622
|
window.history.replaceState(null, "", url);
|
|
4607
4623
|
window.dispatchEvent(new HashChangeEvent("hashchange"));
|
|
4608
4624
|
}
|