@digital-b2c/coreui-kit 0.10.1 → 0.10.2

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
@@ -839,7 +839,8 @@ var FilterBar_module_default = {
839
839
  searchInput: "FilterBar_module_searchInput",
840
840
  searchClear: "FilterBar_module_searchClear",
841
841
  dropdownPanel: "FilterBar_module_dropdownPanel",
842
- searchPanel: "FilterBar_module_searchPanel",
842
+ filterFaded: "FilterBar_module_filterFaded",
843
+ filterFading: "FilterBar_module_filterFading",
843
844
  dropdownOption: "FilterBar_module_dropdownOption",
844
845
  selected: "FilterBar_module_selected"
845
846
  };
@@ -868,7 +869,6 @@ function FilterBar({
868
869
  const [searchState, setSearchState] = React62.useState("closed");
869
870
  const filterRef = React62.useRef(null);
870
871
  const sortRef = React62.useRef(null);
871
- const searchRef = React62.useRef(null);
872
872
  const searchInputRef = React62.useRef(null);
873
873
  const closeSearch = () => {
874
874
  setSearchState("closing");
@@ -881,10 +881,9 @@ function FilterBar({
881
881
  };
882
882
  React62.useEffect(() => {
883
883
  const handleMouseDown = (e) => {
884
- var _a, _b, _c;
884
+ var _a, _b;
885
885
  const target = e.target;
886
- if (((_a = filterRef.current) == null ? void 0 : _a.contains(target)) || ((_b = sortRef.current) == null ? void 0 : _b.contains(target)) || ((_c = searchRef.current) == null ? void 0 : _c.contains(target)))
887
- return;
886
+ if (((_a = filterRef.current) == null ? void 0 : _a.contains(target)) || ((_b = sortRef.current) == null ? void 0 : _b.contains(target))) return;
888
887
  setOpenDropdown(null);
889
888
  };
890
889
  document.addEventListener("mousedown", handleMouseDown);
@@ -894,10 +893,6 @@ function FilterBar({
894
893
  var _a;
895
894
  if (searchState === "open") (_a = searchInputRef.current) == null ? void 0 : _a.focus();
896
895
  }, [searchState]);
897
- React62.useEffect(() => {
898
- var _a;
899
- if (openDropdown === "search") (_a = searchInputRef.current) == null ? void 0 : _a.focus();
900
- }, [openDropdown]);
901
896
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FilterBar_module_default.filterBar, children: [
902
897
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FilterBar_module_default.viewToggle, children: [
903
898
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -928,90 +923,108 @@ function FilterBar({
928
923
  )
929
924
  ] }),
930
925
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FilterBar_module_default.filterActions, children: [
931
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FilterBar_module_default.dropdownWrapper, ref: filterRef, children: [
932
- /* @__PURE__ */ jsxRuntime.jsxs(
933
- "button",
934
- {
935
- type: "button",
936
- className: clsx25__default.default(FilterBar_module_default.chip, filterValue !== "all" && FilterBar_module_default.active),
937
- onClick: () => setOpenDropdown(openDropdown === "filter" ? null : "filter"),
938
- "aria-expanded": openDropdown === "filter",
939
- children: [
940
- /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: "filter", size: 20, "aria-hidden": "true" }),
941
- !isMobile && /* @__PURE__ */ jsxRuntime.jsx("span", { className: FilterBar_module_default.chipLabel, children: "Filter" })
942
- ]
943
- }
944
- ),
945
- openDropdown === "filter" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: FilterBar_module_default.dropdownPanel, role: "listbox", "aria-label": "Filter by type", children: FILTER_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(
946
- "button",
947
- {
948
- type: "button",
949
- role: "option",
950
- "aria-selected": filterValue === opt.value,
951
- className: clsx25__default.default(
952
- FilterBar_module_default.dropdownOption,
953
- filterValue === opt.value && FilterBar_module_default.selected
926
+ /* @__PURE__ */ jsxRuntime.jsxs(
927
+ "div",
928
+ {
929
+ className: clsx25__default.default(
930
+ FilterBar_module_default.dropdownWrapper,
931
+ isMobile && searchState === "open" && FilterBar_module_default.filterFaded,
932
+ isMobile && searchState === "closing" && FilterBar_module_default.filterFading
933
+ ),
934
+ ref: filterRef,
935
+ children: [
936
+ /* @__PURE__ */ jsxRuntime.jsxs(
937
+ "button",
938
+ {
939
+ type: "button",
940
+ className: clsx25__default.default(FilterBar_module_default.chip, filterValue !== "all" && FilterBar_module_default.active),
941
+ onClick: () => setOpenDropdown(openDropdown === "filter" ? null : "filter"),
942
+ "aria-expanded": openDropdown === "filter",
943
+ children: [
944
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: "filter", size: 20, "aria-hidden": "true" }),
945
+ !isMobile && /* @__PURE__ */ jsxRuntime.jsx("span", { className: FilterBar_module_default.chipLabel, children: "Filter" })
946
+ ]
947
+ }
954
948
  ),
955
- onClick: () => {
956
- onFilterChange(filterValue === opt.value ? "all" : opt.value);
957
- setOpenDropdown(null);
958
- },
959
- children: [
960
- /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: opt.icon, size: 20, "aria-hidden": "true" }),
961
- opt.label
962
- ]
963
- },
964
- opt.value
965
- )) })
966
- ] }),
967
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FilterBar_module_default.dropdownWrapper, ref: sortRef, children: [
968
- /* @__PURE__ */ jsxRuntime.jsxs(
969
- "button",
970
- {
971
- type: "button",
972
- className: FilterBar_module_default.chip,
973
- onClick: () => setOpenDropdown(openDropdown === "sort" ? null : "sort"),
974
- "aria-expanded": openDropdown === "sort",
975
- children: [
976
- /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: "internalFilter", size: 20, "aria-hidden": "true" }),
977
- !isMobile && /* @__PURE__ */ jsxRuntime.jsx("span", { className: FilterBar_module_default.chipLabel, children: "Sort" })
978
- ]
979
- }
980
- ),
981
- openDropdown === "sort" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: FilterBar_module_default.dropdownPanel, role: "listbox", "aria-label": "Sort by", children: SORT_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(
982
- "button",
983
- {
984
- type: "button",
985
- role: "option",
986
- "aria-selected": sortValue === opt.value,
987
- className: clsx25__default.default(
988
- FilterBar_module_default.dropdownOption,
989
- sortValue === opt.value && FilterBar_module_default.selected
949
+ openDropdown === "filter" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: FilterBar_module_default.dropdownPanel, role: "listbox", "aria-label": "Filter by type", children: FILTER_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(
950
+ "button",
951
+ {
952
+ type: "button",
953
+ role: "option",
954
+ "aria-selected": filterValue === opt.value,
955
+ className: clsx25__default.default(
956
+ FilterBar_module_default.dropdownOption,
957
+ filterValue === opt.value && FilterBar_module_default.selected
958
+ ),
959
+ onClick: () => {
960
+ onFilterChange(filterValue === opt.value ? "all" : opt.value);
961
+ setOpenDropdown(null);
962
+ },
963
+ children: [
964
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: opt.icon, size: 20, "aria-hidden": "true" }),
965
+ opt.label
966
+ ]
967
+ },
968
+ opt.value
969
+ )) })
970
+ ]
971
+ }
972
+ ),
973
+ /* @__PURE__ */ jsxRuntime.jsxs(
974
+ "div",
975
+ {
976
+ className: clsx25__default.default(
977
+ FilterBar_module_default.dropdownWrapper,
978
+ isMobile && searchState === "open" && FilterBar_module_default.filterFaded,
979
+ isMobile && searchState === "closing" && FilterBar_module_default.filterFading
980
+ ),
981
+ ref: sortRef,
982
+ children: [
983
+ /* @__PURE__ */ jsxRuntime.jsxs(
984
+ "button",
985
+ {
986
+ type: "button",
987
+ className: FilterBar_module_default.chip,
988
+ onClick: () => setOpenDropdown(openDropdown === "sort" ? null : "sort"),
989
+ "aria-expanded": openDropdown === "sort",
990
+ children: [
991
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: "internalFilter", size: 20, "aria-hidden": "true" }),
992
+ !isMobile && /* @__PURE__ */ jsxRuntime.jsx("span", { className: FilterBar_module_default.chipLabel, children: "Sort" })
993
+ ]
994
+ }
990
995
  ),
991
- onClick: () => {
992
- onSortChange(opt.value);
993
- setOpenDropdown(null);
994
- },
995
- children: opt.label
996
- },
997
- opt.value
998
- )) })
999
- ] }),
1000
- isMobile ? (
1001
- /* Mobile — popup panel, mirroring the Filter/Sort dropdowns */
1002
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FilterBar_module_default.dropdownWrapper, ref: searchRef, children: [
1003
- /* @__PURE__ */ jsxRuntime.jsx(
1004
- "button",
1005
- {
1006
- type: "button",
1007
- className: clsx25__default.default(FilterBar_module_default.chip, searchValue !== "" && FilterBar_module_default.active),
1008
- onClick: () => setOpenDropdown(openDropdown === "search" ? null : "search"),
1009
- "aria-expanded": openDropdown === "search",
1010
- "aria-label": "Search",
1011
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: "search", size: 20, "aria-hidden": "true" })
1012
- }
996
+ openDropdown === "sort" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: FilterBar_module_default.dropdownPanel, role: "listbox", "aria-label": "Sort by", children: SORT_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(
997
+ "button",
998
+ {
999
+ type: "button",
1000
+ role: "option",
1001
+ "aria-selected": sortValue === opt.value,
1002
+ className: clsx25__default.default(
1003
+ FilterBar_module_default.dropdownOption,
1004
+ sortValue === opt.value && FilterBar_module_default.selected
1005
+ ),
1006
+ onClick: () => {
1007
+ onSortChange(opt.value);
1008
+ setOpenDropdown(null);
1009
+ },
1010
+ children: opt.label
1011
+ },
1012
+ opt.value
1013
+ )) })
1014
+ ]
1015
+ }
1016
+ ),
1017
+ searchState !== "closed" ? /* @__PURE__ */ jsxRuntime.jsxs(
1018
+ "div",
1019
+ {
1020
+ className: clsx25__default.default(
1021
+ FilterBar_module_default.searchExpanded,
1022
+ searchState === "closing" && FilterBar_module_default.searchCollapsing
1013
1023
  ),
1014
- openDropdown === "search" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FilterBar_module_default.searchPanel, children: [
1024
+ onAnimationEnd: () => {
1025
+ if (searchState === "closing") setSearchState("closed");
1026
+ },
1027
+ children: [
1015
1028
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: FilterBar_module_default.searchIconInner, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: "search", size: 20, "aria-hidden": "true" }) }),
1016
1029
  /* @__PURE__ */ jsxRuntime.jsx(
1017
1030
  "input",
@@ -1025,8 +1038,11 @@ function FilterBar({
1025
1038
  onKeyDown: (e) => {
1026
1039
  if (e.key === "Escape") {
1027
1040
  if (searchValue) clearSearch();
1028
- else setOpenDropdown(null);
1041
+ else closeSearch();
1029
1042
  }
1043
+ },
1044
+ onBlur: () => {
1045
+ if (!searchValue) closeSearch();
1030
1046
  }
1031
1047
  }
1032
1048
  ),
@@ -1036,64 +1052,28 @@ function FilterBar({
1036
1052
  type: "button",
1037
1053
  className: FilterBar_module_default.searchClear,
1038
1054
  "aria-label": "Clear search",
1055
+ onMouseDown: (e) => e.preventDefault(),
1039
1056
  onClick: clearSearch,
1040
1057
  children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: "xBlack", size: 16, "aria-hidden": "true" })
1041
1058
  }
1042
1059
  )
1043
- ] })
1044
- ] })
1045
- ) : searchState !== "closed" ? (
1046
- /* Desktop — animated inline expand */
1047
- /* @__PURE__ */ jsxRuntime.jsxs(
1048
- "div",
1049
- {
1050
- className: clsx25__default.default(
1051
- FilterBar_module_default.searchExpanded,
1052
- searchState === "closing" && FilterBar_module_default.searchCollapsing
1053
- ),
1054
- onAnimationEnd: () => {
1055
- if (searchState === "closing") setSearchState("closed");
1056
- },
1057
- children: [
1058
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: FilterBar_module_default.searchIconInner, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: "search", size: 20, "aria-hidden": "true" }) }),
1059
- /* @__PURE__ */ jsxRuntime.jsx(
1060
- "input",
1061
- {
1062
- ref: searchInputRef,
1063
- type: "text",
1064
- className: FilterBar_module_default.searchInput,
1065
- placeholder: "Search\u2026",
1066
- value: searchValue,
1067
- onChange: (e) => onSearchChange(e.target.value),
1068
- onKeyDown: (e) => {
1069
- if (e.key === "Escape") {
1070
- if (searchValue) clearSearch();
1071
- else closeSearch();
1072
- }
1073
- },
1074
- onBlur: () => {
1075
- if (!searchValue) closeSearch();
1076
- }
1077
- }
1078
- ),
1079
- searchValue && /* @__PURE__ */ jsxRuntime.jsx(
1080
- "button",
1081
- {
1082
- type: "button",
1083
- className: FilterBar_module_default.searchClear,
1084
- "aria-label": "Clear search",
1085
- onMouseDown: (e) => e.preventDefault(),
1086
- onClick: clearSearch,
1087
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: "xBlack", size: 16, "aria-hidden": "true" })
1088
- }
1089
- )
1090
- ]
1091
- }
1092
- )
1093
- ) : /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: FilterBar_module_default.chip, onClick: () => setSearchState("open"), children: [
1094
- /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: "search", size: 20, "aria-hidden": "true" }),
1095
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: FilterBar_module_default.chipLabel, children: "Search" })
1096
- ] })
1060
+ ]
1061
+ }
1062
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
1063
+ "button",
1064
+ {
1065
+ type: "button",
1066
+ className: FilterBar_module_default.chip,
1067
+ onClick: () => {
1068
+ setOpenDropdown(null);
1069
+ setSearchState("open");
1070
+ },
1071
+ children: [
1072
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: "search", size: 20, "aria-hidden": "true" }),
1073
+ !isMobile && /* @__PURE__ */ jsxRuntime.jsx("span", { className: FilterBar_module_default.chipLabel, children: "Search" })
1074
+ ]
1075
+ }
1076
+ )
1097
1077
  ] })
1098
1078
  ] });
1099
1079
  }