@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 CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Luxottica
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luxottica
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,52 +1,52 @@
1
- # CoreUI Kit
2
-
3
- A React‑based design system and component library.
4
-
5
- ## 🚀 Getting Started
6
-
7
- Install
8
-
9
- ```bash
10
- npm install
11
- ```
12
-
13
- Development
14
-
15
- - Run the build in watch mode
16
-
17
- ```bash
18
- npm run dev
19
- ```
20
-
21
- Start Storybook
22
-
23
- ```bash
24
- npm run storybook
25
- ```
26
-
27
- Run tests
28
-
29
- ```bash
30
- npm test
31
- ```
32
-
33
- Lint/format
34
-
35
- ```bash
36
- npm run lint
37
- ```
38
-
39
- ## 🛠️ Usage
40
-
41
- Import components in other projects:
42
-
43
- ```ts
44
- import '@digital-b2c/coreui-kit/styles.css'
45
-
46
- import { MiniSectionCta } from '@digital-b2c/coreui-kit'
47
-
48
- <MiniSectionCta>
49
- <MiniSectionCta.Title>Header</MiniSectionCta.Title>
50
- <MiniSectionCta.Subtitle>Description</MiniSectionCta.Subtitle>
51
- </MiniSectionCta>
52
- ```
1
+ # CoreUI Kit
2
+
3
+ A React‑based design system and component library.
4
+
5
+ ## 🚀 Getting Started
6
+
7
+ Install
8
+
9
+ ```bash
10
+ npm install
11
+ ```
12
+
13
+ Development
14
+
15
+ - Run the build in watch mode
16
+
17
+ ```bash
18
+ npm run dev
19
+ ```
20
+
21
+ Start Storybook
22
+
23
+ ```bash
24
+ npm run storybook
25
+ ```
26
+
27
+ Run tests
28
+
29
+ ```bash
30
+ npm test
31
+ ```
32
+
33
+ Lint/format
34
+
35
+ ```bash
36
+ npm run lint
37
+ ```
38
+
39
+ ## 🛠️ Usage
40
+
41
+ Import components in other projects:
42
+
43
+ ```ts
44
+ import '@digital-b2c/coreui-kit/styles.css'
45
+
46
+ import { MiniSectionCta } from '@digital-b2c/coreui-kit'
47
+
48
+ <MiniSectionCta>
49
+ <MiniSectionCta.Title>Header</MiniSectionCta.Title>
50
+ <MiniSectionCta.Subtitle>Description</MiniSectionCta.Subtitle>
51
+ </MiniSectionCta>
52
+ ```
package/dist/index.cjs CHANGED
@@ -4581,6 +4581,16 @@ var ResourcesGridList_module_default = {
4581
4581
  notificationDot: "ResourcesGridList_module_notificationDot"
4582
4582
  };
4583
4583
  var ITEMS_PER_PAGE = 12;
4584
+ var getCategorySlug = (cat) => {
4585
+ var _a;
4586
+ return (cat == null ? void 0 : cat.extension) || ((_a = cat == null ? void 0 : cat.label) == null ? void 0 : _a.replaceAll(" ", "-").toLocaleLowerCase());
4587
+ };
4588
+ var subscribeHash = (onStoreChange) => {
4589
+ window.addEventListener("hashchange", onStoreChange);
4590
+ return () => window.removeEventListener("hashchange", onStoreChange);
4591
+ };
4592
+ var getHashSnapshot = () => window.location.hash;
4593
+ var getServerHashSnapshot = () => "";
4584
4594
  var ResourcesGridList = ({
4585
4595
  className,
4586
4596
  items = [],
@@ -4596,22 +4606,28 @@ var ResourcesGridList = ({
4596
4606
  const [sortValue, setSortValue] = React71.useState(defaultSort);
4597
4607
  const [searchQuery, setSearchQuery] = React71.useState("");
4598
4608
  const [currentPage, setCurrentPage] = React71.useState(1);
4599
- const [selectedCategory, setSelectedCategory] = React71.useState(() => {
4600
- const activeIndex = categories.findIndex((cat) => cat.active);
4601
- return activeIndex === -1 ? 0 : activeIndex;
4602
- });
4603
4609
  const widgetRef = React71.useRef(null);
4604
4610
  const { is } = useViewPort_default();
4605
4611
  const isMobile = is("tablet", "below");
4612
+ const currentHash = React71.useSyncExternalStore(subscribeHash, getHashSnapshot, getServerHashSnapshot);
4613
+ const selectedCategory = (() => {
4614
+ const hash = decodeURIComponent(currentHash.replace(/^#/, ""));
4615
+ if (hash) {
4616
+ const hashIndex = categories.findIndex((cat) => getCategorySlug(cat) === hash);
4617
+ if (hashIndex !== -1) return hashIndex;
4618
+ }
4619
+ const activeIndex = categories.findIndex((cat) => cat.active);
4620
+ return activeIndex === -1 ? 0 : activeIndex;
4621
+ })();
4606
4622
  const selectedValue = (_a = categories[selectedCategory]) == null ? void 0 : _a.value;
4607
4623
  const handleSelectCategory = (index) => {
4608
4624
  var _a2, _b;
4609
- setSelectedCategory(index);
4610
4625
  setCurrentPage(1);
4611
4626
  const categoryText = (_b = (_a2 = categories[index]) == null ? void 0 : _a2.label) == null ? void 0 : _b.replaceAll(" ", "-");
4627
+ const slug = getCategorySlug(categories[index]);
4612
4628
  if (typeof window !== "undefined" && categoryText) {
4613
4629
  const base_url = window.location.pathname.endsWith("/") ? window.location.pathname.slice(0, -1) : window.location.pathname;
4614
- const url = categoryText !== "All-Resources" ? `${base_url}#${categoryText}` : `${base_url}`;
4630
+ const url = categoryText !== "All-Resources" ? `${base_url}/#${slug}` : `${base_url}`;
4615
4631
  window.history.replaceState(null, "", url);
4616
4632
  window.dispatchEvent(new HashChangeEvent("hashchange"));
4617
4633
  }