@drawbridge/components 0.0.40 → 0.0.42

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.
@@ -924,6 +924,7 @@ var DefaultImage2 = ({ alt, className, src }) => /* @__PURE__ */ (0, import_jsx_
924
924
  );
925
925
  var Product = ({
926
926
  action = null,
927
+ addToCart = true,
927
928
  disabled = false,
928
929
  errors = {},
929
930
  header,
@@ -1164,10 +1165,10 @@ var Product = ({
1164
1165
  "div",
1165
1166
  {
1166
1167
  ...{
1167
- className: "grid grid-cols-2 gap-3"
1168
+ className: addToCart ? "grid grid-cols-2 gap-3" : ""
1168
1169
  },
1169
1170
  children: [
1170
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1171
+ addToCart && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1171
1172
  "button",
1172
1173
  {
1173
1174
  ...{
@@ -1191,7 +1192,7 @@ var Product = ({
1191
1192
  "button",
1192
1193
  {
1193
1194
  ...{
1194
- className: "button justify-center",
1195
+ className: "button justify-center" + (addToCart ? "" : " w-full"),
1195
1196
  disabled: disabled || Boolean(action),
1196
1197
  onClick: onBuy,
1197
1198
  style: buttonStyle(style),
@@ -1231,6 +1232,7 @@ var Advertisement = ({
1231
1232
  disabled = false,
1232
1233
  errors,
1233
1234
  file,
1235
+ fonts,
1234
1236
  header,
1235
1237
  id,
1236
1238
  ImageComponent,
@@ -1258,6 +1260,7 @@ var Advertisement = ({
1258
1260
  {
1259
1261
  ...{
1260
1262
  action,
1263
+ addToCart: false,
1261
1264
  disabled: preview || disabled,
1262
1265
  errors,
1263
1266
  header,
@@ -1282,6 +1285,7 @@ var Advertisement = ({
1282
1285
  brand: brand || { style },
1283
1286
  button,
1284
1287
  campaign,
1288
+ fonts,
1285
1289
  ImageComponent,
1286
1290
  lead,
1287
1291
  onClick,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  product_default
4
- } from "./chunk-HDOA3Y3U.mjs";
4
+ } from "./chunk-GUSVATKJ.mjs";
5
5
  import "./chunk-2ZYGRSSA.mjs";
6
6
  import "./chunk-XWELEL6Z.mjs";
7
7
  import {
@@ -24,6 +24,7 @@ var Advertisement = ({
24
24
  disabled = false,
25
25
  errors,
26
26
  file,
27
+ fonts,
27
28
  header,
28
29
  id,
29
30
  ImageComponent,
@@ -51,6 +52,7 @@ var Advertisement = ({
51
52
  {
52
53
  ...{
53
54
  action,
55
+ addToCart: false,
54
56
  disabled: preview || disabled,
55
57
  errors,
56
58
  header,
@@ -75,6 +77,7 @@ var Advertisement = ({
75
77
  brand: brand || { style },
76
78
  button,
77
79
  campaign,
80
+ fonts,
78
81
  ImageComponent,
79
82
  lead,
80
83
  onClick,
@@ -33,6 +33,7 @@ var DefaultImage = ({ alt, className, src }) => /* @__PURE__ */ jsx(
33
33
  );
34
34
  var Product = ({
35
35
  action = null,
36
+ addToCart = true,
36
37
  disabled = false,
37
38
  errors = {},
38
39
  header,
@@ -273,10 +274,10 @@ var Product = ({
273
274
  "div",
274
275
  {
275
276
  ...{
276
- className: "grid grid-cols-2 gap-3"
277
+ className: addToCart ? "grid grid-cols-2 gap-3" : ""
277
278
  },
278
279
  children: [
279
- /* @__PURE__ */ jsx(
280
+ addToCart && /* @__PURE__ */ jsx(
280
281
  "button",
281
282
  {
282
283
  ...{
@@ -300,7 +301,7 @@ var Product = ({
300
301
  "button",
301
302
  {
302
303
  ...{
303
- className: "button justify-center",
304
+ className: "button justify-center" + (addToCart ? "" : " w-full"),
304
305
  disabled: disabled || Boolean(action),
305
306
  onClick: onBuy,
306
307
  style: buttonStyle(style),
package/dist/product.js CHANGED
@@ -567,6 +567,7 @@ var DefaultImage = ({ alt, className, src }) => /* @__PURE__ */ (0, import_jsx_r
567
567
  );
568
568
  var Product = ({
569
569
  action = null,
570
+ addToCart = true,
570
571
  disabled = false,
571
572
  errors = {},
572
573
  header,
@@ -807,10 +808,10 @@ var Product = ({
807
808
  "div",
808
809
  {
809
810
  ...{
810
- className: "grid grid-cols-2 gap-3"
811
+ className: addToCart ? "grid grid-cols-2 gap-3" : ""
811
812
  },
812
813
  children: [
813
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
814
+ addToCart && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
814
815
  "button",
815
816
  {
816
817
  ...{
@@ -834,7 +835,7 @@ var Product = ({
834
835
  "button",
835
836
  {
836
837
  ...{
837
- className: "button justify-center",
838
+ className: "button justify-center" + (addToCart ? "" : " w-full"),
838
839
  disabled: disabled || Boolean(action),
839
840
  onClick: onBuy,
840
841
  style: buttonStyle(style),
package/dist/product.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  product_default
4
- } from "./chunk-HDOA3Y3U.mjs";
4
+ } from "./chunk-GUSVATKJ.mjs";
5
5
  import "./chunk-2ZYGRSSA.mjs";
6
6
  import "./chunk-XWELEL6Z.mjs";
7
7
  import "./chunk-7ZLMDYBR.mjs";
@@ -0,0 +1,94 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // components/provider-font.js
20
+ var provider_font_exports = {};
21
+ __export(provider_font_exports, {
22
+ default: () => provider_font_default
23
+ });
24
+ module.exports = __toCommonJS(provider_font_exports);
25
+ var import_react = require("react");
26
+ var import_jsx_runtime = require("react/jsx-runtime");
27
+ var defaults = {
28
+ family: "Roboto Flex",
29
+ transform: "none"
30
+ };
31
+ var toWeight = (value) => {
32
+ var _a;
33
+ if (value.includes("italic")) return (_a = value.match(/^\d+/)) == null ? void 0 : _a[0];
34
+ if (value.includes("regular")) return "normal";
35
+ return value;
36
+ };
37
+ var ProviderFont = (0, import_react.memo)(({
38
+ body,
39
+ children,
40
+ heading,
41
+ onError
42
+ }) => {
43
+ const { url, fonts } = (0, import_react.useMemo)(
44
+ () => {
45
+ const bodyFamily = (body == null ? void 0 : body.family) || defaults.family;
46
+ const headingFamily = (heading == null ? void 0 : heading.family) || defaults.family;
47
+ const same = headingFamily === bodyFamily;
48
+ const url2 = [
49
+ "https://fonts.googleapis.com/css?family=" + bodyFamily.replace(/ /g, "+")
50
+ ];
51
+ const fonts2 = {
52
+ body: {
53
+ fontFamily: '"' + bodyFamily + '"',
54
+ textTransform: (body == null ? void 0 : body.transform) || defaults.transform
55
+ },
56
+ heading: {
57
+ fontFamily: '"' + headingFamily + '"',
58
+ textTransform: (heading == null ? void 0 : heading.transform) || defaults.transform
59
+ }
60
+ };
61
+ if (body == null ? void 0 : body.weight) {
62
+ url2.push(":" + body.weight);
63
+ fonts2.body.fontWeight = toWeight(body.weight);
64
+ }
65
+ if (!same) {
66
+ url2.push("%7C" + headingFamily.replace(/ /g, "+"));
67
+ }
68
+ if (heading == null ? void 0 : heading.weight) {
69
+ url2.push((same ? "," : ":") + heading.weight);
70
+ fonts2.heading.fontWeight = toWeight(heading.weight);
71
+ }
72
+ url2.push("&display=swap");
73
+ return { url: url2, fonts: fonts2 };
74
+ },
75
+ [body, heading]
76
+ );
77
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
+ "link",
80
+ {
81
+ ...{
82
+ href: url.join(""),
83
+ rel: "stylesheet",
84
+ ...onError && {
85
+ onError
86
+ }
87
+ }
88
+ }
89
+ ),
90
+ children(fonts)
91
+ ] });
92
+ });
93
+ ProviderFont.displayName = "ProviderFont";
94
+ var provider_font_default = ProviderFont;
@@ -0,0 +1,74 @@
1
+ // components/provider-font.js
2
+ import { Fragment, memo, useMemo } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ var defaults = {
5
+ family: "Roboto Flex",
6
+ transform: "none"
7
+ };
8
+ var toWeight = (value) => {
9
+ var _a;
10
+ if (value.includes("italic")) return (_a = value.match(/^\d+/)) == null ? void 0 : _a[0];
11
+ if (value.includes("regular")) return "normal";
12
+ return value;
13
+ };
14
+ var ProviderFont = memo(({
15
+ body,
16
+ children,
17
+ heading,
18
+ onError
19
+ }) => {
20
+ const { url, fonts } = useMemo(
21
+ () => {
22
+ const bodyFamily = (body == null ? void 0 : body.family) || defaults.family;
23
+ const headingFamily = (heading == null ? void 0 : heading.family) || defaults.family;
24
+ const same = headingFamily === bodyFamily;
25
+ const url2 = [
26
+ "https://fonts.googleapis.com/css?family=" + bodyFamily.replace(/ /g, "+")
27
+ ];
28
+ const fonts2 = {
29
+ body: {
30
+ fontFamily: '"' + bodyFamily + '"',
31
+ textTransform: (body == null ? void 0 : body.transform) || defaults.transform
32
+ },
33
+ heading: {
34
+ fontFamily: '"' + headingFamily + '"',
35
+ textTransform: (heading == null ? void 0 : heading.transform) || defaults.transform
36
+ }
37
+ };
38
+ if (body == null ? void 0 : body.weight) {
39
+ url2.push(":" + body.weight);
40
+ fonts2.body.fontWeight = toWeight(body.weight);
41
+ }
42
+ if (!same) {
43
+ url2.push("%7C" + headingFamily.replace(/ /g, "+"));
44
+ }
45
+ if (heading == null ? void 0 : heading.weight) {
46
+ url2.push((same ? "," : ":") + heading.weight);
47
+ fonts2.heading.fontWeight = toWeight(heading.weight);
48
+ }
49
+ url2.push("&display=swap");
50
+ return { url: url2, fonts: fonts2 };
51
+ },
52
+ [body, heading]
53
+ );
54
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
55
+ /* @__PURE__ */ jsx(
56
+ "link",
57
+ {
58
+ ...{
59
+ href: url.join(""),
60
+ rel: "stylesheet",
61
+ ...onError && {
62
+ onError
63
+ }
64
+ }
65
+ }
66
+ ),
67
+ children(fonts)
68
+ ] });
69
+ });
70
+ ProviderFont.displayName = "ProviderFont";
71
+ var provider_font_default = ProviderFont;
72
+ export {
73
+ provider_font_default as default
74
+ };
package/dist/video.js CHANGED
@@ -87,12 +87,14 @@ var ReactPlayer = (0, import_dynamic.default)(
87
87
  }
88
88
  );
89
89
  var Video = ({
90
+ className,
90
91
  controls = false,
91
92
  loop = false,
92
93
  onEnded = () => {
93
94
  },
94
95
  onDuration = () => {
95
96
  },
97
+ onTime,
96
98
  muted = true,
97
99
  onPlay,
98
100
  playing = false,
@@ -114,7 +116,7 @@ var Video = ({
114
116
  },
115
117
  [player, reset]
116
118
  );
117
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react.Fragment, { children: [
119
+ const inner = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react.Fragment, { children: [
118
120
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
119
121
  ReactPlayer,
120
122
  {
@@ -140,6 +142,13 @@ var Video = ({
140
142
  onDuration(value);
141
143
  }
142
144
  },
145
+ onProgress: ({ playedSeconds }) => {
146
+ onTime == null ? void 0 : onTime(playedSeconds);
147
+ },
148
+ onSeek: (seconds) => {
149
+ onTime == null ? void 0 : onTime(seconds);
150
+ },
151
+ progressInterval: 100,
143
152
  onError: () => {
144
153
  setVideoUrl(mp4);
145
154
  },
@@ -173,5 +182,14 @@ var Video = ({
173
182
  }
174
183
  )
175
184
  ] });
185
+ return className ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
186
+ "div",
187
+ {
188
+ ...{
189
+ className
190
+ },
191
+ children: inner
192
+ }
193
+ ) : inner;
176
194
  };
177
195
  var video_default = Video;
package/dist/video.mjs CHANGED
@@ -14,12 +14,14 @@ var ReactPlayer = dynamic(
14
14
  }
15
15
  );
16
16
  var Video = ({
17
+ className,
17
18
  controls = false,
18
19
  loop = false,
19
20
  onEnded = () => {
20
21
  },
21
22
  onDuration = () => {
22
23
  },
24
+ onTime,
23
25
  muted = true,
24
26
  onPlay,
25
27
  playing = false,
@@ -41,7 +43,7 @@ var Video = ({
41
43
  },
42
44
  [player, reset]
43
45
  );
44
- return /* @__PURE__ */ jsxs(Fragment, { children: [
46
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
45
47
  /* @__PURE__ */ jsx(
46
48
  ReactPlayer,
47
49
  {
@@ -67,6 +69,13 @@ var Video = ({
67
69
  onDuration(value);
68
70
  }
69
71
  },
72
+ onProgress: ({ playedSeconds }) => {
73
+ onTime == null ? void 0 : onTime(playedSeconds);
74
+ },
75
+ onSeek: (seconds) => {
76
+ onTime == null ? void 0 : onTime(seconds);
77
+ },
78
+ progressInterval: 100,
70
79
  onError: () => {
71
80
  setVideoUrl(mp4);
72
81
  },
@@ -100,6 +109,15 @@ var Video = ({
100
109
  }
101
110
  )
102
111
  ] });
112
+ return className ? /* @__PURE__ */ jsx(
113
+ "div",
114
+ {
115
+ ...{
116
+ className
117
+ },
118
+ children: inner
119
+ }
120
+ ) : inner;
103
121
  };
104
122
  var video_default = Video;
105
123
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.0.40",
3
+ "version": "0.0.42",
4
4
  "exports": {
5
5
  "./advertisement": {
6
6
  "types": "./types/advertisement.d.ts",
@@ -302,6 +302,10 @@
302
302
  "types": "./types/product.d.ts",
303
303
  "default": "./dist/product.js"
304
304
  },
305
+ "./provider-font": {
306
+ "types": "./types/provider-font.d.ts",
307
+ "default": "./dist/provider-font.js"
308
+ },
305
309
  "./styles": {
306
310
  "types": "./types/styles.d.ts",
307
311
  "default": "./dist/styles.js"
@@ -10,6 +10,7 @@ export interface AdvertisementProps {
10
10
  disabled?: boolean;
11
11
  errors?: { variant?: ReactNode; root?: ReactNode };
12
12
  file?: any;
13
+ fonts?: Record<string, unknown>;
13
14
  header?: ReactNode;
14
15
  id?: string;
15
16
  ImageComponent?: ComponentType<any>;
@@ -3,6 +3,7 @@ import { BrandStyle } from './styles';
3
3
 
4
4
  export interface ProductProps {
5
5
  action?: 'add' | 'buy' | null;
6
+ addToCart?: boolean;
6
7
  disabled?: boolean;
7
8
  errors?: { variant?: ReactNode; root?: ReactNode };
8
9
  header?: ReactNode;
@@ -0,0 +1,23 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+
3
+ export interface ProviderFontFamily {
4
+ family?: string;
5
+ transform?: string;
6
+ weight?: string;
7
+ }
8
+
9
+ export interface ProviderFontFonts {
10
+ body: Record<string, string | undefined>;
11
+ heading: Record<string, string | undefined>;
12
+ }
13
+
14
+ export interface ProviderFontProps {
15
+ body?: ProviderFontFamily;
16
+ children: ( fonts: ProviderFontFonts ) => ReactNode;
17
+ heading?: ProviderFontFamily;
18
+ onError?: () => void;
19
+ }
20
+
21
+ declare const ProviderFont: ComponentType<ProviderFontProps>;
22
+
23
+ export default ProviderFont;
package/types/video.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ComponentType } from 'react';
2
2
 
3
3
  export interface VideoProps {
4
+ className?: string;
4
5
  controls?: boolean;
5
6
  hls?: string;
6
7
  loop?: boolean;
@@ -9,6 +10,7 @@ export interface VideoProps {
9
10
  onDuration?: ( seconds: number ) => void;
10
11
  onEnded?: () => void;
11
12
  onPlay?: () => void;
13
+ onTime?: ( seconds: number ) => void;
12
14
  playing?: boolean;
13
15
  poster?: string;
14
16
  reset?: boolean;