@drawbridge/components 0.0.42 → 0.0.43

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.
@@ -432,7 +432,8 @@ var InputGroup = ({
432
432
  input,
433
433
  label,
434
434
  message,
435
- style = {}
435
+ style = {},
436
+ ...rest
436
437
  }) => {
437
438
  var _a, _b, _c, _d;
438
439
  const classes = [
@@ -449,7 +450,10 @@ var InputGroup = ({
449
450
  {
450
451
  ...{
451
452
  className: classes.join(" "),
452
- "aria-live": "polite"
453
+ "aria-live": "polite",
454
+ ...(rest == null ? void 0 : rest["data-guide"]) && {
455
+ "data-guide": rest["data-guide"]
456
+ }
453
457
  },
454
458
  children: [
455
459
  label ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import {
3
3
  product_default
4
- } from "./chunk-GUSVATKJ.mjs";
4
+ } from "./chunk-BHQBSNGK.mjs";
5
+ import "./chunk-BD3TDNJE.mjs";
6
+ import "./chunk-FYA7EAMR.mjs";
5
7
  import "./chunk-2ZYGRSSA.mjs";
6
8
  import "./chunk-XWELEL6Z.mjs";
7
9
  import {
8
10
  card_advertisement_default
9
11
  } from "./chunk-TJNIR4PF.mjs";
10
- import "./chunk-7ZLMDYBR.mjs";
12
+ import "./chunk-JJH46E7B.mjs";
11
13
  import "./chunk-Q3UIVGPQ.mjs";
12
- import "./chunk-BD3TDNJE.mjs";
13
- import "./chunk-FYA7EAMR.mjs";
14
14
  import "./chunk-FJXG3REN.mjs";
15
15
 
16
16
  // components/advertisement.js
@@ -1,3 +1,6 @@
1
+ import {
2
+ input_select_default
3
+ } from "./chunk-BD3TDNJE.mjs";
1
4
  import {
2
5
  loader_default
3
6
  } from "./chunk-2ZYGRSSA.mjs";
@@ -6,10 +9,7 @@ import {
6
9
  } from "./chunk-XWELEL6Z.mjs";
7
10
  import {
8
11
  input_group_default
9
- } from "./chunk-7ZLMDYBR.mjs";
10
- import {
11
- input_select_default
12
- } from "./chunk-BD3TDNJE.mjs";
12
+ } from "./chunk-JJH46E7B.mjs";
13
13
  import {
14
14
  buttonStyle,
15
15
  inputStyle
@@ -0,0 +1,37 @@
1
+ import {
2
+ inputStyle
3
+ } from "./chunk-FJXG3REN.mjs";
4
+
5
+ // components/input-text.js
6
+ import { jsx } from "react/jsx-runtime";
7
+ var InputText = ({
8
+ className,
9
+ max,
10
+ onChange,
11
+ style,
12
+ value,
13
+ ...rest
14
+ }) => {
15
+ const classes = ["input"];
16
+ if (className) {
17
+ classes.push(className);
18
+ }
19
+ ;
20
+ return /* @__PURE__ */ jsx(
21
+ "input",
22
+ {
23
+ ...{
24
+ ...rest,
25
+ className: classes.join(" "),
26
+ onChange: ({ target }) => onChange(target.value),
27
+ style: inputStyle(style),
28
+ value
29
+ }
30
+ }
31
+ );
32
+ };
33
+ var input_text_default = InputText;
34
+
35
+ export {
36
+ input_text_default
37
+ };
@@ -11,7 +11,8 @@ var InputGroup = ({
11
11
  input,
12
12
  label,
13
13
  message,
14
- style = {}
14
+ style = {},
15
+ ...rest
15
16
  }) => {
16
17
  var _a, _b, _c, _d;
17
18
  const classes = [
@@ -28,7 +29,10 @@ var InputGroup = ({
28
29
  {
29
30
  ...{
30
31
  className: classes.join(" "),
31
- "aria-live": "polite"
32
+ "aria-live": "polite",
33
+ ...(rest == null ? void 0 : rest["data-guide"]) && {
34
+ "data-guide": rest["data-guide"]
35
+ }
32
36
  },
33
37
  children: [
34
38
  label ? /* @__PURE__ */ jsxs(
@@ -58,7 +58,8 @@ var InputGroup = ({
58
58
  input,
59
59
  label,
60
60
  message,
61
- style = {}
61
+ style = {},
62
+ ...rest
62
63
  }) => {
63
64
  var _a, _b, _c, _d;
64
65
  const classes = [
@@ -75,7 +76,10 @@ var InputGroup = ({
75
76
  {
76
77
  ...{
77
78
  className: classes.join(" "),
78
- "aria-live": "polite"
79
+ "aria-live": "polite",
80
+ ...(rest == null ? void 0 : rest["data-guide"]) && {
81
+ "data-guide": rest["data-guide"]
82
+ }
79
83
  },
80
84
  children: [
81
85
  label ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  input_group_default
3
- } from "./chunk-7ZLMDYBR.mjs";
3
+ } from "./chunk-JJH46E7B.mjs";
4
4
  import "./chunk-Q3UIVGPQ.mjs";
5
5
  export {
6
6
  input_group_default as default
@@ -0,0 +1,307 @@
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/input-name.js
20
+ var input_name_exports = {};
21
+ __export(input_name_exports, {
22
+ default: () => input_name_default
23
+ });
24
+ module.exports = __toCommonJS(input_name_exports);
25
+
26
+ // components/input-group.js
27
+ var import_react = require("react");
28
+
29
+ // components/icons/warning.js
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var Warning = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
32
+ "svg",
33
+ {
34
+ ...{
35
+ fill: "none",
36
+ stroke: "currentColor",
37
+ strokeWidth: 1.5,
38
+ viewBox: "0 0 24 24",
39
+ ...props
40
+ },
41
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
42
+ "path",
43
+ {
44
+ ...{
45
+ d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z",
46
+ strokeLinecap: "round",
47
+ strokeLinejoin: "round"
48
+ }
49
+ }
50
+ )
51
+ }
52
+ );
53
+ var warning_default = Warning;
54
+
55
+ // components/input-group.js
56
+ var import_jsx_runtime2 = require("react/jsx-runtime");
57
+ var InputGroup = ({
58
+ className,
59
+ error,
60
+ input,
61
+ label,
62
+ message,
63
+ style = {},
64
+ ...rest
65
+ }) => {
66
+ var _a, _b, _c, _d;
67
+ const classes = [
68
+ "input-group"
69
+ ];
70
+ if (className) {
71
+ classes.push(className);
72
+ }
73
+ if (error) {
74
+ classes.push("error");
75
+ }
76
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
77
+ "div",
78
+ {
79
+ ...{
80
+ className: classes.join(" "),
81
+ "aria-live": "polite",
82
+ ...(rest == null ? void 0 : rest["data-guide"]) && {
83
+ "data-guide": rest["data-guide"]
84
+ }
85
+ },
86
+ children: [
87
+ label ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
88
+ "div",
89
+ {
90
+ ...{
91
+ className: "space-y-2"
92
+ },
93
+ children: [
94
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
95
+ "span",
96
+ {
97
+ ...{
98
+ className: "block"
99
+ },
100
+ children: label
101
+ }
102
+ ),
103
+ input
104
+ ]
105
+ }
106
+ ) : input,
107
+ (error || message) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
108
+ "p",
109
+ {
110
+ ...{
111
+ className: "flex items-center justify-start space-x-2 py-1 rounded text-sm " + (error && "px-1.5"),
112
+ ...error && Object.keys(style).length > 0 && {
113
+ style: {
114
+ backgroundColor: (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb.replace(")", ",.1)"),
115
+ color: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb
116
+ }
117
+ }
118
+ },
119
+ children: [
120
+ error && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react.Fragment, { children: [
121
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
122
+ warning_default,
123
+ {
124
+ ...{
125
+ className: "w-4 h-4",
126
+ "aria-hidden": true
127
+ }
128
+ }
129
+ ),
130
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
131
+ "span",
132
+ {
133
+ ...{
134
+ className: "text-[0px] opacity-0 w-0 h-0 absolute"
135
+ },
136
+ children: [
137
+ label,
138
+ ": ",
139
+ error
140
+ ]
141
+ }
142
+ )
143
+ ] }),
144
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
145
+ "span",
146
+ {
147
+ ...{
148
+ ...error && {
149
+ "aria-hidden": true
150
+ }
151
+ },
152
+ children: error || message
153
+ }
154
+ )
155
+ ]
156
+ }
157
+ )
158
+ ]
159
+ }
160
+ );
161
+ };
162
+ var input_group_default = InputGroup;
163
+
164
+ // components/styles.js
165
+ var inputStyle = (style) => {
166
+ var _a, _b, _c, _d, _e, _f, _g;
167
+ return {
168
+ backgroundColor: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb,
169
+ borderColor: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb,
170
+ borderRadius: ((_e = style == null ? void 0 : style.input) == null ? void 0 : _e.radius) != null ? style.input.radius / 4 + "px" : void 0,
171
+ color: (_g = (_f = style == null ? void 0 : style.text) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb
172
+ };
173
+ };
174
+
175
+ // components/input-text.js
176
+ var import_jsx_runtime3 = require("react/jsx-runtime");
177
+ var InputText = ({
178
+ className,
179
+ max,
180
+ onChange,
181
+ style,
182
+ value,
183
+ ...rest
184
+ }) => {
185
+ const classes = ["input"];
186
+ if (className) {
187
+ classes.push(className);
188
+ }
189
+ ;
190
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
191
+ "input",
192
+ {
193
+ ...{
194
+ ...rest,
195
+ className: classes.join(" "),
196
+ onChange: ({ target }) => onChange(target.value),
197
+ style: inputStyle(style),
198
+ value
199
+ }
200
+ }
201
+ );
202
+ };
203
+ var input_text_default = InputText;
204
+
205
+ // components/input-name.js
206
+ var import_jsx_runtime4 = require("react/jsx-runtime");
207
+ var InputName = ({
208
+ error,
209
+ onChange,
210
+ settings,
211
+ style,
212
+ value = {}
213
+ }) => {
214
+ var _a, _b, _c;
215
+ const inputs = {
216
+ first: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
217
+ input_group_default,
218
+ {
219
+ ...{
220
+ error: (_a = error == null ? void 0 : error.first) == null ? void 0 : _a.message,
221
+ input: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
222
+ input_text_default,
223
+ {
224
+ ...{
225
+ "aria-label": "First Name",
226
+ onChange: (first) => onChange({
227
+ ...value,
228
+ first
229
+ }),
230
+ style,
231
+ value: (value == null ? void 0 : value.first) || ""
232
+ }
233
+ }
234
+ ),
235
+ label: "First name",
236
+ style
237
+ }
238
+ }
239
+ ),
240
+ last: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
241
+ input_group_default,
242
+ {
243
+ ...{
244
+ error: (_b = error == null ? void 0 : error.last) == null ? void 0 : _b.message,
245
+ input: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
246
+ input_text_default,
247
+ {
248
+ ...{
249
+ "aria-label": "Last Name",
250
+ onChange: (last) => onChange({
251
+ ...value,
252
+ last
253
+ }),
254
+ style,
255
+ value: (value == null ? void 0 : value.last) || ""
256
+ }
257
+ }
258
+ ),
259
+ label: "Last name",
260
+ style
261
+ }
262
+ }
263
+ ),
264
+ name: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
265
+ input_group_default,
266
+ {
267
+ ...{
268
+ error: (_c = error == null ? void 0 : error.name) == null ? void 0 : _c.message,
269
+ input: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
270
+ input_text_default,
271
+ {
272
+ ...{
273
+ onChange: (name) => onChange({
274
+ ...value,
275
+ name
276
+ }),
277
+ style,
278
+ value: (value == null ? void 0 : value.name) || ""
279
+ }
280
+ }
281
+ ),
282
+ label: "Full name",
283
+ style
284
+ }
285
+ }
286
+ )
287
+ };
288
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
289
+ "div",
290
+ {
291
+ ...{
292
+ className: "flex flex-col space-y-4"
293
+ },
294
+ children: (settings.capture || []).map((input, key) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
295
+ "div",
296
+ {
297
+ ...{
298
+ className: "w-full"
299
+ },
300
+ children: inputs[input]
301
+ },
302
+ "input-name-" + key
303
+ ))
304
+ }
305
+ );
306
+ };
307
+ var input_name_default = InputName;
@@ -0,0 +1,115 @@
1
+ import {
2
+ input_text_default
3
+ } from "./chunk-BZ6WMIH7.mjs";
4
+ import {
5
+ input_group_default
6
+ } from "./chunk-JJH46E7B.mjs";
7
+ import "./chunk-Q3UIVGPQ.mjs";
8
+ import "./chunk-FJXG3REN.mjs";
9
+
10
+ // components/input-name.js
11
+ import { jsx } from "react/jsx-runtime";
12
+ var InputName = ({
13
+ error,
14
+ onChange,
15
+ settings,
16
+ style,
17
+ value = {}
18
+ }) => {
19
+ var _a, _b, _c;
20
+ const inputs = {
21
+ first: /* @__PURE__ */ jsx(
22
+ input_group_default,
23
+ {
24
+ ...{
25
+ error: (_a = error == null ? void 0 : error.first) == null ? void 0 : _a.message,
26
+ input: /* @__PURE__ */ jsx(
27
+ input_text_default,
28
+ {
29
+ ...{
30
+ "aria-label": "First Name",
31
+ onChange: (first) => onChange({
32
+ ...value,
33
+ first
34
+ }),
35
+ style,
36
+ value: (value == null ? void 0 : value.first) || ""
37
+ }
38
+ }
39
+ ),
40
+ label: "First name",
41
+ style
42
+ }
43
+ }
44
+ ),
45
+ last: /* @__PURE__ */ jsx(
46
+ input_group_default,
47
+ {
48
+ ...{
49
+ error: (_b = error == null ? void 0 : error.last) == null ? void 0 : _b.message,
50
+ input: /* @__PURE__ */ jsx(
51
+ input_text_default,
52
+ {
53
+ ...{
54
+ "aria-label": "Last Name",
55
+ onChange: (last) => onChange({
56
+ ...value,
57
+ last
58
+ }),
59
+ style,
60
+ value: (value == null ? void 0 : value.last) || ""
61
+ }
62
+ }
63
+ ),
64
+ label: "Last name",
65
+ style
66
+ }
67
+ }
68
+ ),
69
+ name: /* @__PURE__ */ jsx(
70
+ input_group_default,
71
+ {
72
+ ...{
73
+ error: (_c = error == null ? void 0 : error.name) == null ? void 0 : _c.message,
74
+ input: /* @__PURE__ */ jsx(
75
+ input_text_default,
76
+ {
77
+ ...{
78
+ onChange: (name) => onChange({
79
+ ...value,
80
+ name
81
+ }),
82
+ style,
83
+ value: (value == null ? void 0 : value.name) || ""
84
+ }
85
+ }
86
+ ),
87
+ label: "Full name",
88
+ style
89
+ }
90
+ }
91
+ )
92
+ };
93
+ return /* @__PURE__ */ jsx(
94
+ "div",
95
+ {
96
+ ...{
97
+ className: "flex flex-col space-y-4"
98
+ },
99
+ children: (settings.capture || []).map((input, key) => /* @__PURE__ */ jsx(
100
+ "div",
101
+ {
102
+ ...{
103
+ className: "w-full"
104
+ },
105
+ children: inputs[input]
106
+ },
107
+ "input-name-" + key
108
+ ))
109
+ }
110
+ );
111
+ };
112
+ var input_name_default = InputName;
113
+ export {
114
+ input_name_default as default
115
+ };
@@ -1,9 +1,9 @@
1
- import {
2
- plus_default
3
- } from "./chunk-HH7WF5BT.mjs";
4
1
  import {
5
2
  minus_default
6
3
  } from "./chunk-T5QQBFM3.mjs";
4
+ import {
5
+ plus_default
6
+ } from "./chunk-HH7WF5BT.mjs";
7
7
  import {
8
8
  inputStyle
9
9
  } from "./chunk-FJXG3REN.mjs";
@@ -0,0 +1,183 @@
1
+ "use client";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // components/input-phone.js
31
+ var input_phone_exports = {};
32
+ __export(input_phone_exports, {
33
+ default: () => input_phone_default,
34
+ isValidPhone: () => isValidPhone
35
+ });
36
+ module.exports = __toCommonJS(input_phone_exports);
37
+ var import_style = require("react-phone-number-input/style.css");
38
+ var import_react = require("react");
39
+ var import_input = __toESM(require("react-phone-number-input/input"));
40
+ var import_phone = require("@drawbridge/drawbridge-utils/phone");
41
+
42
+ // components/styles.js
43
+ var inputStyle = (style) => {
44
+ var _a, _b, _c, _d, _e, _f, _g;
45
+ return {
46
+ backgroundColor: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb,
47
+ borderColor: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb,
48
+ borderRadius: ((_e = style == null ? void 0 : style.input) == null ? void 0 : _e.radius) != null ? style.input.radius / 4 + "px" : void 0,
49
+ color: (_g = (_f = style == null ? void 0 : style.text) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb
50
+ };
51
+ };
52
+ var inputPhoneStyle = (style) => inputStyle(style);
53
+
54
+ // components/input-phone.js
55
+ var import_jsx_runtime = require("react/jsx-runtime");
56
+ var isValidPhone = (number = "", country = "") => {
57
+ const valid = (0, import_phone.isValid)(number, country);
58
+ return valid;
59
+ };
60
+ var InputPhone = ({
61
+ countries = [],
62
+ onChange,
63
+ style,
64
+ value = {}
65
+ }) => {
66
+ var _a, _b;
67
+ const [country, setCountry] = (0, import_react.useState)((value == null ? void 0 : value.country) || (countries == null ? void 0 : countries[0]));
68
+ const [number, setNumber] = (0, import_react.useState)((value == null ? void 0 : value.number) || "");
69
+ (0, import_react.useEffect)(
70
+ () => {
71
+ if (value == null ? void 0 : value.country) return;
72
+ const tags = [navigator.language, ...navigator.languages || []];
73
+ const detected = tags.map((tag) => {
74
+ var _a2, _b2;
75
+ return (_b2 = (_a2 = tag == null ? void 0 : tag.split("-")) == null ? void 0 : _a2[1]) == null ? void 0 : _b2.toUpperCase();
76
+ }).find((code) => code && countries.includes(code));
77
+ if (detected) setCountry(detected);
78
+ },
79
+ []
80
+ );
81
+ (0, import_react.useEffect)(
82
+ () => {
83
+ onChange({
84
+ country,
85
+ number
86
+ });
87
+ },
88
+ [country, number, onChange]
89
+ );
90
+ const [keyboard, setKeyboard] = (0, import_react.useState)(false);
91
+ (0, import_react.useEffect)(
92
+ () => {
93
+ const down = (e) => {
94
+ if (e.key === "Tab") setKeyboard(true);
95
+ };
96
+ const click = () => setKeyboard(false);
97
+ window.addEventListener("keydown", down);
98
+ window.addEventListener("mousedown", click);
99
+ return () => {
100
+ window.removeEventListener("keydown", down);
101
+ window.removeEventListener("mousedown", click);
102
+ };
103
+ },
104
+ []
105
+ );
106
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
107
+ "div",
108
+ {
109
+ ...{
110
+ className: "flex items-center input !p-0 overflow-hidden",
111
+ style: inputPhoneStyle(style)
112
+ },
113
+ children: [
114
+ (countries == null ? void 0 : countries.length) > 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
115
+ "select",
116
+ {
117
+ ...{
118
+ className: "px-3 bg-none appearance-none border-none " + (keyboard ? "focus-visible:!border focus-visible:!border-inherit !rounded-none " : "focus-visible:!outline-0 focus-visible:!ring-0"),
119
+ onChange: ({ target }) => {
120
+ setCountry(target.value);
121
+ setNumber("");
122
+ },
123
+ style: inputPhoneStyle(style),
124
+ value: country
125
+ },
126
+ children: countries.map((item, key) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
127
+ "option",
128
+ {
129
+ ...{
130
+ value: item
131
+ },
132
+ children: item
133
+ },
134
+ "input-phone-country-" + item + "-" + key
135
+ ))
136
+ }
137
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
138
+ "span",
139
+ {
140
+ ...{
141
+ className: "px-3 flex items-center",
142
+ style: inputPhoneStyle(style)
143
+ },
144
+ children: (countries == null ? void 0 : countries[0]) || ""
145
+ }
146
+ ),
147
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
148
+ "div",
149
+ {
150
+ ...{
151
+ className: "w-full",
152
+ style: {
153
+ borderLeft: "solid 1px " + ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.hex)
154
+ }
155
+ },
156
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
157
+ import_input.default,
158
+ {
159
+ ...{
160
+ "aria-label": "Phone Number",
161
+ className: "input w-full border-none focus:outline-none focus:ring-0 focus:border-inherit",
162
+ onChange: (val) => setNumber(val),
163
+ style: inputPhoneStyle(style),
164
+ value: number,
165
+ ...country && {
166
+ country,
167
+ international: true,
168
+ withCountryCallingCode: true
169
+ }
170
+ }
171
+ }
172
+ )
173
+ }
174
+ )
175
+ ]
176
+ }
177
+ );
178
+ };
179
+ var input_phone_default = InputPhone;
180
+ // Annotate the CommonJS export names for ESM import in node:
181
+ 0 && (module.exports = {
182
+ isValidPhone
183
+ });
@@ -0,0 +1,139 @@
1
+ "use client";
2
+ import {
3
+ inputPhoneStyle
4
+ } from "./chunk-FJXG3REN.mjs";
5
+
6
+ // components/input-phone.js
7
+ import "react-phone-number-input/style.css";
8
+ import { useEffect, useState } from "react";
9
+ import Input from "react-phone-number-input/input";
10
+ import { isValid } from "@drawbridge/drawbridge-utils/phone";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ var isValidPhone = (number = "", country = "") => {
13
+ const valid = isValid(number, country);
14
+ return valid;
15
+ };
16
+ var InputPhone = ({
17
+ countries = [],
18
+ onChange,
19
+ style,
20
+ value = {}
21
+ }) => {
22
+ var _a, _b;
23
+ const [country, setCountry] = useState((value == null ? void 0 : value.country) || (countries == null ? void 0 : countries[0]));
24
+ const [number, setNumber] = useState((value == null ? void 0 : value.number) || "");
25
+ useEffect(
26
+ () => {
27
+ if (value == null ? void 0 : value.country) return;
28
+ const tags = [navigator.language, ...navigator.languages || []];
29
+ const detected = tags.map((tag) => {
30
+ var _a2, _b2;
31
+ return (_b2 = (_a2 = tag == null ? void 0 : tag.split("-")) == null ? void 0 : _a2[1]) == null ? void 0 : _b2.toUpperCase();
32
+ }).find((code) => code && countries.includes(code));
33
+ if (detected) setCountry(detected);
34
+ },
35
+ []
36
+ );
37
+ useEffect(
38
+ () => {
39
+ onChange({
40
+ country,
41
+ number
42
+ });
43
+ },
44
+ [country, number, onChange]
45
+ );
46
+ const [keyboard, setKeyboard] = useState(false);
47
+ useEffect(
48
+ () => {
49
+ const down = (e) => {
50
+ if (e.key === "Tab") setKeyboard(true);
51
+ };
52
+ const click = () => setKeyboard(false);
53
+ window.addEventListener("keydown", down);
54
+ window.addEventListener("mousedown", click);
55
+ return () => {
56
+ window.removeEventListener("keydown", down);
57
+ window.removeEventListener("mousedown", click);
58
+ };
59
+ },
60
+ []
61
+ );
62
+ return /* @__PURE__ */ jsxs(
63
+ "div",
64
+ {
65
+ ...{
66
+ className: "flex items-center input !p-0 overflow-hidden",
67
+ style: inputPhoneStyle(style)
68
+ },
69
+ children: [
70
+ (countries == null ? void 0 : countries.length) > 1 ? /* @__PURE__ */ jsx(
71
+ "select",
72
+ {
73
+ ...{
74
+ className: "px-3 bg-none appearance-none border-none " + (keyboard ? "focus-visible:!border focus-visible:!border-inherit !rounded-none " : "focus-visible:!outline-0 focus-visible:!ring-0"),
75
+ onChange: ({ target }) => {
76
+ setCountry(target.value);
77
+ setNumber("");
78
+ },
79
+ style: inputPhoneStyle(style),
80
+ value: country
81
+ },
82
+ children: countries.map((item, key) => /* @__PURE__ */ jsx(
83
+ "option",
84
+ {
85
+ ...{
86
+ value: item
87
+ },
88
+ children: item
89
+ },
90
+ "input-phone-country-" + item + "-" + key
91
+ ))
92
+ }
93
+ ) : /* @__PURE__ */ jsx(
94
+ "span",
95
+ {
96
+ ...{
97
+ className: "px-3 flex items-center",
98
+ style: inputPhoneStyle(style)
99
+ },
100
+ children: (countries == null ? void 0 : countries[0]) || ""
101
+ }
102
+ ),
103
+ /* @__PURE__ */ jsx(
104
+ "div",
105
+ {
106
+ ...{
107
+ className: "w-full",
108
+ style: {
109
+ borderLeft: "solid 1px " + ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.hex)
110
+ }
111
+ },
112
+ children: /* @__PURE__ */ jsx(
113
+ Input,
114
+ {
115
+ ...{
116
+ "aria-label": "Phone Number",
117
+ className: "input w-full border-none focus:outline-none focus:ring-0 focus:border-inherit",
118
+ onChange: (val) => setNumber(val),
119
+ style: inputPhoneStyle(style),
120
+ value: number,
121
+ ...country && {
122
+ country,
123
+ international: true,
124
+ withCountryCallingCode: true
125
+ }
126
+ }
127
+ }
128
+ )
129
+ }
130
+ )
131
+ ]
132
+ }
133
+ );
134
+ };
135
+ var input_phone_default = InputPhone;
136
+ export {
137
+ input_phone_default as default,
138
+ isValidPhone
139
+ };
@@ -1,36 +1,7 @@
1
1
  import {
2
- inputStyle
3
- } from "./chunk-FJXG3REN.mjs";
4
-
5
- // components/input-text.js
6
- import { jsx } from "react/jsx-runtime";
7
- var InputText = ({
8
- className,
9
- max,
10
- onChange,
11
- style,
12
- value,
13
- ...rest
14
- }) => {
15
- const classes = ["input"];
16
- if (className) {
17
- classes.push(className);
18
- }
19
- ;
20
- return /* @__PURE__ */ jsx(
21
- "input",
22
- {
23
- ...{
24
- ...rest,
25
- className: classes.join(" "),
26
- onChange: ({ target }) => onChange(target.value),
27
- style: inputStyle(style),
28
- value
29
- }
30
- }
31
- );
32
- };
33
- var input_text_default = InputText;
2
+ input_text_default
3
+ } from "./chunk-BZ6WMIH7.mjs";
4
+ import "./chunk-FJXG3REN.mjs";
34
5
  export {
35
6
  input_text_default as default
36
7
  };
package/dist/product.js CHANGED
@@ -75,7 +75,8 @@ var InputGroup = ({
75
75
  input,
76
76
  label,
77
77
  message,
78
- style = {}
78
+ style = {},
79
+ ...rest
79
80
  }) => {
80
81
  var _a, _b, _c, _d;
81
82
  const classes = [
@@ -92,7 +93,10 @@ var InputGroup = ({
92
93
  {
93
94
  ...{
94
95
  className: classes.join(" "),
95
- "aria-live": "polite"
96
+ "aria-live": "polite",
97
+ ...(rest == null ? void 0 : rest["data-guide"]) && {
98
+ "data-guide": rest["data-guide"]
99
+ }
96
100
  },
97
101
  children: [
98
102
  label ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
package/dist/product.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  product_default
4
- } from "./chunk-GUSVATKJ.mjs";
4
+ } from "./chunk-BHQBSNGK.mjs";
5
+ import "./chunk-BD3TDNJE.mjs";
6
+ import "./chunk-FYA7EAMR.mjs";
5
7
  import "./chunk-2ZYGRSSA.mjs";
6
8
  import "./chunk-XWELEL6Z.mjs";
7
- import "./chunk-7ZLMDYBR.mjs";
9
+ import "./chunk-JJH46E7B.mjs";
8
10
  import "./chunk-Q3UIVGPQ.mjs";
9
- import "./chunk-BD3TDNJE.mjs";
10
- import "./chunk-FYA7EAMR.mjs";
11
11
  import "./chunk-FJXG3REN.mjs";
12
12
  export {
13
13
  product_default as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "exports": {
5
5
  "./advertisement": {
6
6
  "types": "./types/advertisement.d.ts",
@@ -282,10 +282,18 @@
282
282
  "types": "./types/input-group.d.ts",
283
283
  "default": "./dist/input-group.js"
284
284
  },
285
+ "./input-name": {
286
+ "types": "./types/input-name.d.ts",
287
+ "default": "./dist/input-name.js"
288
+ },
285
289
  "./input-number": {
286
290
  "types": "./types/input-number.d.ts",
287
291
  "default": "./dist/input-number.js"
288
292
  },
293
+ "./input-phone": {
294
+ "types": "./types/input-phone.d.ts",
295
+ "default": "./dist/input-phone.js"
296
+ },
289
297
  "./input-select": {
290
298
  "types": "./types/input-select.d.ts",
291
299
  "default": "./dist/input-select.js"
@@ -346,6 +354,7 @@
346
354
  "dependencies": {
347
355
  "@drawbridge/drawbridge-agents": "0.0.10",
348
356
  "embla-carousel-react": "8.6.0",
349
- "react-player": "2.16.0"
357
+ "react-player": "2.16.0",
358
+ "react-phone-number-input": "3.4.12"
350
359
  }
351
360
  }
@@ -8,6 +8,7 @@ export interface InputGroupProps {
8
8
  label?: ReactNode;
9
9
  message?: ReactNode;
10
10
  style?: BrandStyle;
11
+ [key: `data-${string}`]: unknown;
11
12
  }
12
13
 
13
14
  declare const InputGroup: ComponentType<InputGroupProps>;
@@ -0,0 +1,24 @@
1
+ import { ComponentType } from 'react';
2
+ import { BrandStyle } from './styles';
3
+
4
+ export interface InputNameValue {
5
+ first?: string;
6
+ last?: string;
7
+ name?: string;
8
+ }
9
+
10
+ export interface InputNameProps {
11
+ error?: {
12
+ first?: { message?: string };
13
+ last?: { message?: string };
14
+ name?: { message?: string };
15
+ };
16
+ onChange: ( value: InputNameValue ) => void;
17
+ settings: { capture?: Array<'first' | 'last' | 'name'> };
18
+ style?: BrandStyle;
19
+ value?: InputNameValue;
20
+ }
21
+
22
+ declare const InputName: ComponentType<InputNameProps>;
23
+
24
+ export default InputName;
@@ -0,0 +1,20 @@
1
+ import { ComponentType } from 'react';
2
+ import { BrandStyle } from './styles';
3
+
4
+ export declare const isValidPhone: ( number?: string, country?: string ) => boolean;
5
+
6
+ export interface InputPhoneValue {
7
+ country?: string;
8
+ number?: string;
9
+ }
10
+
11
+ export interface InputPhoneProps {
12
+ countries?: string[];
13
+ onChange: ( value: InputPhoneValue ) => void;
14
+ style?: BrandStyle;
15
+ value?: InputPhoneValue;
16
+ }
17
+
18
+ declare const InputPhone: ComponentType<InputPhoneProps>;
19
+
20
+ export default InputPhone;