@digital-b2c/coreui-kit 0.30.0 → 0.30.1

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
@@ -6055,7 +6055,13 @@ var TextCenterWithMedia_module_default = {
6055
6055
  var TextCenterWithMediaTitle = ({ children }) => {
6056
6056
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
6057
6057
  };
6058
- var DIRECT_FILE_PATTERN = /\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?$/i;
6058
+ var YOUTUBE_ID_PATTERN = /(?:youtube\.com\/(?:embed\/|shorts\/)|youtube\.com\/watch\?(?:.*&)?v=|youtu\.be\/)([^/?#&]+)/i;
6059
+ var VIMEO_PATTERN = /vimeo\.com\//i;
6060
+ var isOEmbedProvider = (url) => YOUTUBE_ID_PATTERN.test(url) || VIMEO_PATTERN.test(url);
6061
+ var toOEmbedFriendlyUrl = (url) => {
6062
+ const match = url.match(YOUTUBE_ID_PATTERN);
6063
+ return match ? `https://www.youtube.com/watch?v=${match[1]}` : url;
6064
+ };
6059
6065
  var TextCenterWithMedia = ({
6060
6066
  className,
6061
6067
  title,
@@ -6079,7 +6085,7 @@ var TextCenterWithMedia = ({
6079
6085
  };
6080
6086
  const slots = resolveCompoundSlots(children, { title: TextCenterWithMediaTitle });
6081
6087
  const titleNode = (_a = slots.title) != null ? _a : title;
6082
- const isDirectFile = !!videoUrl && DIRECT_FILE_PATTERN.test(videoUrl);
6088
+ const isDirectFile = !!videoUrl && !isOEmbedProvider(videoUrl);
6083
6089
  return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: clsx73__default.default(TextCenterWithMedia_module_default.textCenterWithMedia, className), children: [
6084
6090
  /* @__PURE__ */ jsxRuntime.jsxs(Container, { children: [
6085
6091
  titleNode && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "h2", children: titleNode }),
@@ -6106,7 +6112,16 @@ var TextCenterWithMedia = ({
6106
6112
  "aria-hidden": "true",
6107
6113
  className: TextCenterWithMedia_module_default.videoPreviewElement
6108
6114
  }
6109
- ) : /* @__PURE__ */ jsxRuntime.jsx(ReactPlayer2__default.default, { src: videoUrl, light: true, playing: false, width: "100%", height: "100%" }),
6115
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
6116
+ ReactPlayer2__default.default,
6117
+ {
6118
+ src: toOEmbedFriendlyUrl(videoUrl),
6119
+ light: true,
6120
+ playing: false,
6121
+ width: "100%",
6122
+ height: "100%"
6123
+ }
6124
+ ),
6110
6125
  /* @__PURE__ */ jsxRuntime.jsx(
6111
6126
  "button",
6112
6127
  {