@drawbridge/components 0.0.68 → 0.0.69

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.
@@ -264,6 +264,17 @@ var textColor = (style) => {
264
264
  var _a, _b;
265
265
  return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
266
266
  };
267
+ var DEFAULT_FAMILY = "Roboto Flex";
268
+ var FONT_FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
269
+ var toFontFamily = (family) => '"' + (family || DEFAULT_FAMILY) + '", ' + FONT_FALLBACK;
270
+ var toFontWeight = (variant) => {
271
+ var _a;
272
+ if (!variant) return void 0;
273
+ if (variant.includes("italic")) return (_a = variant.match(/^\d+/)) == null ? void 0 : _a[0];
274
+ if (variant.includes("regular")) return "normal";
275
+ return variant;
276
+ };
277
+ var toFontStyle = (variant) => (variant == null ? void 0 : variant.includes("italic")) ? "italic" : void 0;
267
278
  var buttonStyle = (style) => {
268
279
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
269
280
  return {
@@ -273,6 +284,15 @@ var buttonStyle = (style) => {
273
284
  color: ((_j = (_i = (_h = style == null ? void 0 : style.button) == null ? void 0 : _h.text) == null ? void 0 : _i.color) == null ? void 0 : _j.rgb) || bgColor(style)
274
285
  };
275
286
  };
287
+ var headerStyle = (style) => {
288
+ var _a, _b, _c, _d;
289
+ return {
290
+ fontFamily: toFontFamily((_a = style == null ? void 0 : style.heading) == null ? void 0 : _a.family),
291
+ fontWeight: toFontWeight((_b = style == null ? void 0 : style.heading) == null ? void 0 : _b.weight),
292
+ fontStyle: toFontStyle((_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.weight),
293
+ textTransform: (_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.transform
294
+ };
295
+ };
276
296
  var inputStyle = (style) => {
277
297
  var _a;
278
298
  return {
@@ -646,7 +666,7 @@ var Product = ({
646
666
  style = {},
647
667
  variant
648
668
  }) => {
649
- var _a, _b, _c, _d, _e, _f;
669
+ var _a, _b, _c;
650
670
  const resolved = {
651
671
  ...style,
652
672
  background: {
@@ -854,11 +874,7 @@ var Product = ({
854
874
  {
855
875
  ...{
856
876
  className: "max-w-80 mx-auto",
857
- style: {
858
- fontFamily: ((_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.family) || (style == null ? void 0 : style.fontFamily) || "Roboto Flex",
859
- fontWeight: ((_e = style == null ? void 0 : style.heading) == null ? void 0 : _e.weight) || (style == null ? void 0 : style.fontWeight),
860
- textTransform: ((_f = style == null ? void 0 : style.heading) == null ? void 0 : _f.transform) || (style == null ? void 0 : style.textTransform)
861
- }
877
+ style: headerStyle(style)
862
878
  },
863
879
  children: product == null ? void 0 : product.title
864
880
  }
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  product_default
4
- } from "./chunk-MG35TMY2.mjs";
4
+ } from "./chunk-QY27O35B.mjs";
5
5
  import "./chunk-PT7UR6AO.mjs";
6
- import "./chunk-3SXAH7B7.mjs";
6
+ import "./chunk-7GRIGQDC.mjs";
7
7
  import "./chunk-FYA7EAMR.mjs";
8
8
  import "./chunk-2ZYGRSSA.mjs";
9
9
  import "./chunk-IIP5OKPN.mjs";
@@ -11,7 +11,7 @@ import "./chunk-OHJMWJAQ.mjs";
11
11
  import "./chunk-Q3UIVGPQ.mjs";
12
12
  import {
13
13
  buttonStyle
14
- } from "./chunk-FJ7PKMAC.mjs";
14
+ } from "./chunk-6F23WKP2.mjs";
15
15
 
16
16
  // components/advertisement.js
17
17
  import { cdnSrc } from "@drawbridge/drawbridge-utils/cdn";
@@ -9,6 +9,17 @@ var textColor = (style) => {
9
9
  var _a, _b;
10
10
  return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
11
11
  };
12
+ var DEFAULT_FAMILY = "Roboto Flex";
13
+ var FONT_FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
14
+ var toFontFamily = (family) => '"' + (family || DEFAULT_FAMILY) + '", ' + FONT_FALLBACK;
15
+ var toFontWeight = (variant) => {
16
+ var _a;
17
+ if (!variant) return void 0;
18
+ if (variant.includes("italic")) return (_a = variant.match(/^\d+/)) == null ? void 0 : _a[0];
19
+ if (variant.includes("regular")) return "normal";
20
+ return variant;
21
+ };
22
+ var toFontStyle = (variant) => (variant == null ? void 0 : variant.includes("italic")) ? "italic" : void 0;
12
23
  var backgroundStyle = (style) => ({
13
24
  backgroundColor: bgColor(style),
14
25
  color: textColor(style)
@@ -30,11 +41,12 @@ var closeStyle = (style) => ({
30
41
  color: bgColor(style)
31
42
  });
32
43
  var headerStyle = (style) => {
33
- var _a, _b, _c;
44
+ var _a, _b, _c, _d;
34
45
  return {
35
- fontFamily: (_a = style == null ? void 0 : style.heading) == null ? void 0 : _a.family,
36
- fontWeight: (_b = style == null ? void 0 : style.heading) == null ? void 0 : _b.weight,
37
- textTransform: (_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.transform
46
+ fontFamily: toFontFamily((_a = style == null ? void 0 : style.heading) == null ? void 0 : _a.family),
47
+ fontWeight: toFontWeight((_b = style == null ? void 0 : style.heading) == null ? void 0 : _b.weight),
48
+ fontStyle: toFontStyle((_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.weight),
49
+ textTransform: (_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.transform
38
50
  };
39
51
  };
40
52
  var inputStyle = (style) => {
@@ -73,6 +85,10 @@ var textStyle = (style) => ({
73
85
  });
74
86
 
75
87
  export {
88
+ FONT_FALLBACK,
89
+ toFontFamily,
90
+ toFontWeight,
91
+ toFontStyle,
76
92
  backgroundStyle,
77
93
  borderStyle,
78
94
  buttonStyle,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-FYA7EAMR.mjs";
4
4
  import {
5
5
  inputStyle
6
- } from "./chunk-FJ7PKMAC.mjs";
6
+ } from "./chunk-6F23WKP2.mjs";
7
7
 
8
8
  // components/input-select.js
9
9
  import { useEffect, useState } from "react";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-PT7UR6AO.mjs";
4
4
  import {
5
5
  input_select_default
6
- } from "./chunk-3SXAH7B7.mjs";
6
+ } from "./chunk-7GRIGQDC.mjs";
7
7
  import {
8
8
  loader_default
9
9
  } from "./chunk-2ZYGRSSA.mjs";
@@ -12,8 +12,9 @@ import {
12
12
  } from "./chunk-IIP5OKPN.mjs";
13
13
  import {
14
14
  buttonStyle,
15
+ headerStyle,
15
16
  inputStyle
16
- } from "./chunk-FJ7PKMAC.mjs";
17
+ } from "./chunk-6F23WKP2.mjs";
17
18
 
18
19
  // components/product.js
19
20
  import { useEffect, useMemo, useState } from "react";
@@ -50,7 +51,7 @@ var Product = ({
50
51
  style = {},
51
52
  variant
52
53
  }) => {
53
- var _a, _b, _c, _d, _e, _f;
54
+ var _a, _b, _c;
54
55
  const resolved = {
55
56
  ...style,
56
57
  background: {
@@ -258,11 +259,7 @@ var Product = ({
258
259
  {
259
260
  ...{
260
261
  className: "max-w-80 mx-auto",
261
- style: {
262
- fontFamily: ((_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.family) || (style == null ? void 0 : style.fontFamily) || "Roboto Flex",
263
- fontWeight: ((_e = style == null ? void 0 : style.heading) == null ? void 0 : _e.weight) || (style == null ? void 0 : style.fontWeight),
264
- textTransform: ((_f = style == null ? void 0 : style.heading) == null ? void 0 : _f.transform) || (style == null ? void 0 : style.textTransform)
265
- }
262
+ style: headerStyle(style)
266
263
  },
267
264
  children: product == null ? void 0 : product.title
268
265
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  inputStyle
3
- } from "./chunk-FJ7PKMAC.mjs";
3
+ } from "./chunk-6F23WKP2.mjs";
4
4
 
5
5
  // components/input-text.js
6
6
  import { jsx } from "react/jsx-runtime";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-GFDZ7ER6.mjs";
4
4
  import {
5
5
  inputCheckboxStyle
6
- } from "./chunk-FJ7PKMAC.mjs";
6
+ } from "./chunk-6F23WKP2.mjs";
7
7
 
8
8
  // components/input-checkbox.js
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  input_text_default
3
- } from "./chunk-B6Y2SNRW.mjs";
3
+ } from "./chunk-Y466XTIK.mjs";
4
4
  import {
5
5
  input_group_default
6
6
  } from "./chunk-IIP5OKPN.mjs";
7
7
  import "./chunk-OHJMWJAQ.mjs";
8
8
  import "./chunk-Q3UIVGPQ.mjs";
9
- import "./chunk-FJ7PKMAC.mjs";
9
+ import "./chunk-6F23WKP2.mjs";
10
10
 
11
11
  // components/input-name.js
12
12
  import { jsx } from "react/jsx-runtime";
@@ -134,7 +134,8 @@ var InputNumber = ({
134
134
  const pattern = decimal ? /^-?\d*\.?\d*$/ : /^-?\d*$/;
135
135
  if (!pattern.test(target.value)) return;
136
136
  setDraft(target.value);
137
- const numeric = target.value === "" ? 0 : Number(target.value);
137
+ if (target.value === "") return onChange(null);
138
+ const numeric = Number(target.value);
138
139
  if (!Number.isNaN(numeric)) onChange(numeric);
139
140
  },
140
141
  [decimal, onChange]
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-T5QQBFM3.mjs";
7
7
  import {
8
8
  inputStyle
9
- } from "./chunk-FJ7PKMAC.mjs";
9
+ } from "./chunk-6F23WKP2.mjs";
10
10
 
11
11
  // components/input-number.js
12
12
  import { useCallback, useEffect, useState } from "react";
@@ -46,7 +46,8 @@ var InputNumber = ({
46
46
  const pattern = decimal ? /^-?\d*\.?\d*$/ : /^-?\d*$/;
47
47
  if (!pattern.test(target.value)) return;
48
48
  setDraft(target.value);
49
- const numeric = target.value === "" ? 0 : Number(target.value);
49
+ if (target.value === "") return onChange(null);
50
+ const numeric = Number(target.value);
50
51
  if (!Number.isNaN(numeric)) onChange(numeric);
51
52
  },
52
53
  [decimal, onChange]
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-FYA7EAMR.mjs";
5
5
  import {
6
6
  inputPhoneStyle
7
- } from "./chunk-FJ7PKMAC.mjs";
7
+ } from "./chunk-6F23WKP2.mjs";
8
8
 
9
9
  // components/input-phone.js
10
10
  import { useEffect, useState } from "react";
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  input_select_default
4
- } from "./chunk-3SXAH7B7.mjs";
4
+ } from "./chunk-7GRIGQDC.mjs";
5
5
  import "./chunk-FYA7EAMR.mjs";
6
- import "./chunk-FJ7PKMAC.mjs";
6
+ import "./chunk-6F23WKP2.mjs";
7
7
  export {
8
8
  input_select_default as default
9
9
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  input_text_default
3
- } from "./chunk-B6Y2SNRW.mjs";
4
- import "./chunk-FJ7PKMAC.mjs";
3
+ } from "./chunk-Y466XTIK.mjs";
4
+ import "./chunk-6F23WKP2.mjs";
5
5
  export {
6
6
  input_text_default as default
7
7
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  inputStyle
3
- } from "./chunk-FJ7PKMAC.mjs";
3
+ } from "./chunk-6F23WKP2.mjs";
4
4
 
5
5
  // components/input-textarea.js
6
6
  import { jsx } from "react/jsx-runtime";
package/dist/product.js CHANGED
@@ -261,6 +261,17 @@ var textColor = (style) => {
261
261
  var _a, _b;
262
262
  return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
263
263
  };
264
+ var DEFAULT_FAMILY = "Roboto Flex";
265
+ var FONT_FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
266
+ var toFontFamily = (family) => '"' + (family || DEFAULT_FAMILY) + '", ' + FONT_FALLBACK;
267
+ var toFontWeight = (variant) => {
268
+ var _a;
269
+ if (!variant) return void 0;
270
+ if (variant.includes("italic")) return (_a = variant.match(/^\d+/)) == null ? void 0 : _a[0];
271
+ if (variant.includes("regular")) return "normal";
272
+ return variant;
273
+ };
274
+ var toFontStyle = (variant) => (variant == null ? void 0 : variant.includes("italic")) ? "italic" : void 0;
264
275
  var buttonStyle = (style) => {
265
276
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
266
277
  return {
@@ -270,6 +281,15 @@ var buttonStyle = (style) => {
270
281
  color: ((_j = (_i = (_h = style == null ? void 0 : style.button) == null ? void 0 : _h.text) == null ? void 0 : _i.color) == null ? void 0 : _j.rgb) || bgColor(style)
271
282
  };
272
283
  };
284
+ var headerStyle = (style) => {
285
+ var _a, _b, _c, _d;
286
+ return {
287
+ fontFamily: toFontFamily((_a = style == null ? void 0 : style.heading) == null ? void 0 : _a.family),
288
+ fontWeight: toFontWeight((_b = style == null ? void 0 : style.heading) == null ? void 0 : _b.weight),
289
+ fontStyle: toFontStyle((_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.weight),
290
+ textTransform: (_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.transform
291
+ };
292
+ };
273
293
  var inputStyle = (style) => {
274
294
  var _a;
275
295
  return {
@@ -643,7 +663,7 @@ var Product = ({
643
663
  style = {},
644
664
  variant
645
665
  }) => {
646
- var _a, _b, _c, _d, _e, _f;
666
+ var _a, _b, _c;
647
667
  const resolved = {
648
668
  ...style,
649
669
  background: {
@@ -851,11 +871,7 @@ var Product = ({
851
871
  {
852
872
  ...{
853
873
  className: "max-w-80 mx-auto",
854
- style: {
855
- fontFamily: ((_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.family) || (style == null ? void 0 : style.fontFamily) || "Roboto Flex",
856
- fontWeight: ((_e = style == null ? void 0 : style.heading) == null ? void 0 : _e.weight) || (style == null ? void 0 : style.fontWeight),
857
- textTransform: ((_f = style == null ? void 0 : style.heading) == null ? void 0 : _f.transform) || (style == null ? void 0 : style.textTransform)
858
- }
874
+ style: headerStyle(style)
859
875
  },
860
876
  children: product == null ? void 0 : product.title
861
877
  }
package/dist/product.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  "use client";
2
2
  import {
3
3
  product_default
4
- } from "./chunk-MG35TMY2.mjs";
4
+ } from "./chunk-QY27O35B.mjs";
5
5
  import "./chunk-PT7UR6AO.mjs";
6
- import "./chunk-3SXAH7B7.mjs";
6
+ import "./chunk-7GRIGQDC.mjs";
7
7
  import "./chunk-FYA7EAMR.mjs";
8
8
  import "./chunk-2ZYGRSSA.mjs";
9
9
  import "./chunk-IIP5OKPN.mjs";
10
10
  import "./chunk-OHJMWJAQ.mjs";
11
11
  import "./chunk-Q3UIVGPQ.mjs";
12
- import "./chunk-FJ7PKMAC.mjs";
12
+ import "./chunk-6F23WKP2.mjs";
13
13
  export {
14
14
  product_default as default
15
15
  };
@@ -23,19 +23,26 @@ __export(provider_font_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(provider_font_exports);
25
25
  var import_react = require("react");
26
+
27
+ // components/styles.js
28
+ var DEFAULT_FAMILY = "Roboto Flex";
29
+ var FONT_FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
30
+ var toFontFamily = (family) => '"' + (family || DEFAULT_FAMILY) + '", ' + FONT_FALLBACK;
31
+ var toFontWeight = (variant) => {
32
+ var _a;
33
+ if (!variant) return void 0;
34
+ if (variant.includes("italic")) return (_a = variant.match(/^\d+/)) == null ? void 0 : _a[0];
35
+ if (variant.includes("regular")) return "normal";
36
+ return variant;
37
+ };
38
+ var toFontStyle = (variant) => (variant == null ? void 0 : variant.includes("italic")) ? "italic" : void 0;
39
+
40
+ // components/provider-font.js
26
41
  var import_jsx_runtime = require("react/jsx-runtime");
27
42
  var defaults = {
28
43
  family: "Roboto Flex",
29
44
  transform: "none"
30
45
  };
31
- var FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
32
- var toWeight = (value) => {
33
- var _a;
34
- if (value.includes("italic")) return (_a = value.match(/^\d+/)) == null ? void 0 : _a[0];
35
- if (value.includes("regular")) return "normal";
36
- return value;
37
- };
38
- var toStyle = (value) => value.includes("italic") ? "italic" : void 0;
39
46
  var ProviderFont = (0, import_react.memo)(({
40
47
  body,
41
48
  children,
@@ -52,26 +59,26 @@ var ProviderFont = (0, import_react.memo)(({
52
59
  ];
53
60
  const fonts2 = {
54
61
  body: {
55
- fontFamily: '"' + bodyFamily + '", ' + FALLBACK,
62
+ fontFamily: toFontFamily(bodyFamily),
56
63
  textTransform: (body == null ? void 0 : body.transform) || defaults.transform
57
64
  },
58
65
  heading: {
59
- fontFamily: '"' + headingFamily + '", ' + FALLBACK,
66
+ fontFamily: toFontFamily(headingFamily),
60
67
  textTransform: (heading == null ? void 0 : heading.transform) || defaults.transform
61
68
  }
62
69
  };
63
70
  if (body == null ? void 0 : body.weight) {
64
71
  url2.push(":" + body.weight);
65
- fonts2.body.fontWeight = toWeight(body.weight);
66
- fonts2.body.fontStyle = toStyle(body.weight);
72
+ fonts2.body.fontWeight = toFontWeight(body.weight);
73
+ fonts2.body.fontStyle = toFontStyle(body.weight);
67
74
  }
68
75
  if (!same) {
69
76
  url2.push("%7C" + headingFamily.replace(/ /g, "+"));
70
77
  }
71
78
  if (heading == null ? void 0 : heading.weight) {
72
79
  url2.push((same ? "," : ":") + heading.weight);
73
- fonts2.heading.fontWeight = toWeight(heading.weight);
74
- fonts2.heading.fontStyle = toStyle(heading.weight);
80
+ fonts2.heading.fontWeight = toFontWeight(heading.weight);
81
+ fonts2.heading.fontStyle = toFontStyle(heading.weight);
75
82
  }
76
83
  url2.push("&display=swap");
77
84
  return { url: url2, fonts: fonts2 };
@@ -1,3 +1,9 @@
1
+ import {
2
+ toFontFamily,
3
+ toFontStyle,
4
+ toFontWeight
5
+ } from "./chunk-6F23WKP2.mjs";
6
+
1
7
  // components/provider-font.js
2
8
  import { Fragment, memo, useMemo } from "react";
3
9
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -5,14 +11,6 @@ var defaults = {
5
11
  family: "Roboto Flex",
6
12
  transform: "none"
7
13
  };
8
- var FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
9
- var toWeight = (value) => {
10
- var _a;
11
- if (value.includes("italic")) return (_a = value.match(/^\d+/)) == null ? void 0 : _a[0];
12
- if (value.includes("regular")) return "normal";
13
- return value;
14
- };
15
- var toStyle = (value) => value.includes("italic") ? "italic" : void 0;
16
14
  var ProviderFont = memo(({
17
15
  body,
18
16
  children,
@@ -29,26 +27,26 @@ var ProviderFont = memo(({
29
27
  ];
30
28
  const fonts2 = {
31
29
  body: {
32
- fontFamily: '"' + bodyFamily + '", ' + FALLBACK,
30
+ fontFamily: toFontFamily(bodyFamily),
33
31
  textTransform: (body == null ? void 0 : body.transform) || defaults.transform
34
32
  },
35
33
  heading: {
36
- fontFamily: '"' + headingFamily + '", ' + FALLBACK,
34
+ fontFamily: toFontFamily(headingFamily),
37
35
  textTransform: (heading == null ? void 0 : heading.transform) || defaults.transform
38
36
  }
39
37
  };
40
38
  if (body == null ? void 0 : body.weight) {
41
39
  url2.push(":" + body.weight);
42
- fonts2.body.fontWeight = toWeight(body.weight);
43
- fonts2.body.fontStyle = toStyle(body.weight);
40
+ fonts2.body.fontWeight = toFontWeight(body.weight);
41
+ fonts2.body.fontStyle = toFontStyle(body.weight);
44
42
  }
45
43
  if (!same) {
46
44
  url2.push("%7C" + headingFamily.replace(/ /g, "+"));
47
45
  }
48
46
  if (heading == null ? void 0 : heading.weight) {
49
47
  url2.push((same ? "," : ":") + heading.weight);
50
- fonts2.heading.fontWeight = toWeight(heading.weight);
51
- fonts2.heading.fontStyle = toStyle(heading.weight);
48
+ fonts2.heading.fontWeight = toFontWeight(heading.weight);
49
+ fonts2.heading.fontStyle = toFontStyle(heading.weight);
52
50
  }
53
51
  url2.push("&display=swap");
54
52
  return { url: url2, fonts: fonts2 };
package/dist/styles.js CHANGED
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // components/styles.js
20
20
  var styles_exports = {};
21
21
  __export(styles_exports, {
22
+ FONT_FALLBACK: () => FONT_FALLBACK,
22
23
  backgroundStyle: () => backgroundStyle,
23
24
  borderStyle: () => borderStyle,
24
25
  buttonStyle: () => buttonStyle,
@@ -30,7 +31,10 @@ __export(styles_exports, {
30
31
  inputStyle: () => inputStyle,
31
32
  menuStyle: () => menuStyle,
32
33
  selectStyle: () => selectStyle,
33
- textStyle: () => textStyle
34
+ textStyle: () => textStyle,
35
+ toFontFamily: () => toFontFamily,
36
+ toFontStyle: () => toFontStyle,
37
+ toFontWeight: () => toFontWeight
34
38
  });
35
39
  module.exports = __toCommonJS(styles_exports);
36
40
  var WHITE = "rgb( 255, 255, 255 )";
@@ -43,6 +47,17 @@ var textColor = (style) => {
43
47
  var _a, _b;
44
48
  return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
45
49
  };
50
+ var DEFAULT_FAMILY = "Roboto Flex";
51
+ var FONT_FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
52
+ var toFontFamily = (family) => '"' + (family || DEFAULT_FAMILY) + '", ' + FONT_FALLBACK;
53
+ var toFontWeight = (variant) => {
54
+ var _a;
55
+ if (!variant) return void 0;
56
+ if (variant.includes("italic")) return (_a = variant.match(/^\d+/)) == null ? void 0 : _a[0];
57
+ if (variant.includes("regular")) return "normal";
58
+ return variant;
59
+ };
60
+ var toFontStyle = (variant) => (variant == null ? void 0 : variant.includes("italic")) ? "italic" : void 0;
46
61
  var backgroundStyle = (style) => ({
47
62
  backgroundColor: bgColor(style),
48
63
  color: textColor(style)
@@ -64,11 +79,12 @@ var closeStyle = (style) => ({
64
79
  color: bgColor(style)
65
80
  });
66
81
  var headerStyle = (style) => {
67
- var _a, _b, _c;
82
+ var _a, _b, _c, _d;
68
83
  return {
69
- fontFamily: (_a = style == null ? void 0 : style.heading) == null ? void 0 : _a.family,
70
- fontWeight: (_b = style == null ? void 0 : style.heading) == null ? void 0 : _b.weight,
71
- textTransform: (_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.transform
84
+ fontFamily: toFontFamily((_a = style == null ? void 0 : style.heading) == null ? void 0 : _a.family),
85
+ fontWeight: toFontWeight((_b = style == null ? void 0 : style.heading) == null ? void 0 : _b.weight),
86
+ fontStyle: toFontStyle((_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.weight),
87
+ textTransform: (_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.transform
72
88
  };
73
89
  };
74
90
  var inputStyle = (style) => {
@@ -107,6 +123,7 @@ var textStyle = (style) => ({
107
123
  });
108
124
  // Annotate the CommonJS export names for ESM import in node:
109
125
  0 && (module.exports = {
126
+ FONT_FALLBACK,
110
127
  backgroundStyle,
111
128
  borderStyle,
112
129
  buttonStyle,
@@ -118,5 +135,8 @@ var textStyle = (style) => ({
118
135
  inputStyle,
119
136
  menuStyle,
120
137
  selectStyle,
121
- textStyle
138
+ textStyle,
139
+ toFontFamily,
140
+ toFontStyle,
141
+ toFontWeight
122
142
  });
package/dist/styles.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ FONT_FALLBACK,
2
3
  backgroundStyle,
3
4
  borderStyle,
4
5
  buttonStyle,
@@ -10,9 +11,13 @@ import {
10
11
  inputStyle,
11
12
  menuStyle,
12
13
  selectStyle,
13
- textStyle
14
- } from "./chunk-FJ7PKMAC.mjs";
14
+ textStyle,
15
+ toFontFamily,
16
+ toFontStyle,
17
+ toFontWeight
18
+ } from "./chunk-6F23WKP2.mjs";
15
19
  export {
20
+ FONT_FALLBACK,
16
21
  backgroundStyle,
17
22
  borderStyle,
18
23
  buttonStyle,
@@ -24,5 +29,8 @@ export {
24
29
  inputStyle,
25
30
  menuStyle,
26
31
  selectStyle,
27
- textStyle
32
+ textStyle,
33
+ toFontFamily,
34
+ toFontStyle,
35
+ toFontWeight
28
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.0.68",
3
+ "version": "0.0.69",
4
4
  "exports": {
5
5
  "./advertisement": {
6
6
  "types": "./types/advertisement.d.ts",