@drawbridge/components 0.1.47 → 0.1.48
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/dist/bridge/cart-drawer.js +152 -0
- package/dist/bridge/cart-drawer.mjs +123 -0
- package/dist/bridge/fields.js +278 -0
- package/dist/bridge/fields.mjs +276 -1
- package/dist/bridge/form-subdomain-checkout.js +687 -0
- package/dist/bridge/form-subdomain-checkout.mjs +665 -0
- package/dist/bridge/form-subdomain-shop-modal.js +234 -274
- package/dist/bridge/form-subdomain-shop-modal.mjs +233 -275
- package/dist/bridge/form-subdomain.js +1 -0
- package/dist/bridge/form-subdomain.mjs +2 -1
- package/dist/bridge/lib/age-gate.js +12 -0
- package/dist/bridge/lib/age-gate.mjs +11 -0
- package/dist/bridge/lib/cart.js +79 -0
- package/dist/bridge/lib/cart.mjs +48 -0
- package/dist/bridge/lib/checkout-kit.js +2 -32
- package/dist/bridge/lib/checkout-kit.mjs +2 -32
- package/dist/bridge/product-tile.js +9 -6
- package/dist/bridge/product-tile.mjs +9 -6
- package/dist/bridge/template-layout.js +237 -122
- package/dist/bridge/template-layout.mjs +237 -122
- package/dist/bridge/template-modal.js +28 -73
- package/dist/bridge/template-modal.mjs +29 -74
- package/dist/dashboard/buttons-subscription.js +1 -1
- package/dist/dashboard/buttons-subscription.mjs +1 -1
- package/dist/dashboard/campaign-form.js +7 -2
- package/dist/dashboard/campaign-form.mjs +7 -2
- package/dist/dashboard/card-order.js +22 -4
- package/dist/dashboard/card-order.mjs +22 -4
- package/dist/dashboard/embed-stripe.js +145 -0
- package/dist/dashboard/embed-stripe.mjs +116 -0
- package/dist/dashboard/form-admin-provider.js +71 -17
- package/dist/dashboard/form-admin-provider.mjs +71 -17
- package/dist/dashboard/form-file-upload.js +3 -2
- package/dist/dashboard/form-file-upload.mjs +4 -3
- package/dist/dashboard/form-organization-campaign-advertisements.js +47 -6
- package/dist/dashboard/form-organization-campaign-advertisements.mjs +47 -6
- package/dist/dashboard/form-organization-campaign-field-birthday.js +193 -0
- package/dist/dashboard/form-organization-campaign-field-birthday.mjs +164 -0
- package/dist/dashboard/form-organization-campaign-field-rating.js +246 -0
- package/dist/dashboard/form-organization-campaign-field-rating.mjs +217 -0
- package/dist/dashboard/form-organization-campaign.js +82 -0
- package/dist/dashboard/form-organization-campaign.mjs +81 -0
- package/dist/dashboard/form-organization-connection.js +48 -6
- package/dist/dashboard/form-organization-connection.mjs +48 -7
- package/dist/dashboard/form-organization-product.js +1461 -0
- package/dist/dashboard/form-organization-product.mjs +1425 -0
- package/dist/dashboard/form-organization-workflow.js +72 -1
- package/dist/dashboard/form-organization-workflow.mjs +69 -1
- package/dist/dashboard/form-otc.js +4 -5
- package/dist/dashboard/form-otc.mjs +4 -5
- package/dist/dashboard/form-stripe.js +12 -5
- package/dist/dashboard/form-stripe.mjs +12 -5
- package/dist/dashboard/input-fields.js +11 -158
- package/dist/dashboard/input-fields.mjs +11 -158
- package/dist/dashboard/input-file.js +21 -4
- package/dist/dashboard/input-file.mjs +21 -4
- package/dist/dashboard/input-gallery.js +201 -0
- package/dist/dashboard/input-gallery.mjs +172 -0
- package/dist/dashboard/lib/connection-controls.js +5 -2
- package/dist/dashboard/lib/connection-controls.mjs +3 -1
- package/dist/dashboard/lib/form-page.js +1 -1
- package/dist/dashboard/lib/form-page.mjs +1 -1
- package/dist/dashboard/lib/products.js +169 -0
- package/dist/dashboard/lib/products.mjs +135 -0
- package/dist/dashboard/lib/settings-paths.js +35 -0
- package/dist/dashboard/lib/settings-paths.mjs +11 -0
- package/dist/dashboard/lib/uppy.js +10 -1
- package/dist/dashboard/lib/uppy.mjs +11 -2
- package/dist/dashboard/order-sections.js +456 -6
- package/dist/dashboard/order-sections.mjs +453 -7
- package/dist/dashboard/provider-ui.js +9 -7
- package/dist/dashboard/provider-ui.mjs +9 -7
- package/dist/dashboard/shipping-rates.js +404 -0
- package/dist/dashboard/shipping-rates.mjs +371 -0
- package/dist/dashboard/template-buyer.js +301 -0
- package/dist/dashboard/template-buyer.mjs +267 -0
- package/dist/input-checkbox.js +28 -10
- package/dist/input-checkbox.mjs +28 -10
- package/dist/product.js +96 -24
- package/dist/product.mjs +97 -25
- package/dist/shared/lib/helpers.js +54 -6
- package/dist/shared/lib/helpers.mjs +53 -8
- package/dist/shared/order-summary.js +139 -0
- package/dist/shared/order-summary.mjs +110 -0
- package/package.json +74 -4
- package/types/bridge/cart-drawer.d.ts +31 -0
- package/types/bridge/fields.d.ts +14 -2
- package/types/bridge/form-subdomain-checkout.d.ts +20 -0
- package/types/bridge/form-subdomain-shop-modal.d.ts +27 -3
- package/types/bridge/lib/age-gate.d.ts +5 -0
- package/types/bridge/lib/cart.d.ts +44 -0
- package/types/bridge/lib/checkout-kit.d.ts +2 -10
- package/types/dashboard/card-order.d.ts +6 -0
- package/types/dashboard/embed-stripe.d.ts +25 -0
- package/types/dashboard/form-admin-provider.d.ts +9 -2
- package/types/dashboard/form-file-upload.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-advertisements.d.ts +3 -0
- package/types/dashboard/form-organization-campaign-field-birthday.d.ts +31 -0
- package/types/dashboard/form-organization-campaign-field-rating.d.ts +33 -0
- package/types/dashboard/form-organization-campaign.d.ts +3 -0
- package/types/dashboard/form-organization-connection.d.ts +11 -0
- package/types/dashboard/form-organization-product.d.ts +24 -0
- package/types/dashboard/form-otc.d.ts +5 -1
- package/types/dashboard/form-stripe.d.ts +3 -2
- package/types/dashboard/input-file.d.ts +2 -0
- package/types/dashboard/input-gallery.d.ts +14 -0
- package/types/dashboard/lib/products.d.ts +14 -0
- package/types/dashboard/lib/settings-paths.d.ts +5 -0
- package/types/dashboard/order-sections.d.ts +24 -1
- package/types/dashboard/shipping-rates.d.ts +26 -0
- package/types/dashboard/template-buyer.d.ts +50 -0
- package/types/input-checkbox.d.ts +2 -0
- package/types/shared/lib/helpers.d.ts +4 -0
- package/types/shared/order-summary.d.ts +19 -0
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
var cart_drawer_exports = {};
|
|
30
|
+
__export(cart_drawer_exports, {
|
|
31
|
+
default: () => cart_drawer_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(cart_drawer_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_dynamic = __toESM(require("next/dynamic"));
|
|
37
|
+
var import_form_subdomain_shop_modal = require("./form-subdomain-shop-modal");
|
|
38
|
+
var import_overlay = __toESM(require("../shared/overlay"));
|
|
39
|
+
var import_styles = require("../styles");
|
|
40
|
+
const FormSubdomainCheckout = (0, import_dynamic.default)(() => import("./form-subdomain-checkout"), { ssr: false });
|
|
41
|
+
const CartDrawer = ({
|
|
42
|
+
button,
|
|
43
|
+
cart,
|
|
44
|
+
cut,
|
|
45
|
+
fonts,
|
|
46
|
+
onBack,
|
|
47
|
+
onCart,
|
|
48
|
+
onCheckout,
|
|
49
|
+
onClose,
|
|
50
|
+
onLineRemove,
|
|
51
|
+
onLineUpdate,
|
|
52
|
+
onOpenProduct,
|
|
53
|
+
onPaid,
|
|
54
|
+
open,
|
|
55
|
+
params,
|
|
56
|
+
pay,
|
|
57
|
+
preview,
|
|
58
|
+
style,
|
|
59
|
+
tracking
|
|
60
|
+
}) => {
|
|
61
|
+
const drawer = (0, import_react.useRef)(null);
|
|
62
|
+
(0, import_react.useEffect)(() => {
|
|
63
|
+
if (drawer.current) drawer.current.inert = !open;
|
|
64
|
+
}, [open]);
|
|
65
|
+
(0, import_react.useEffect)(() => {
|
|
66
|
+
if (!open) return;
|
|
67
|
+
const onKey = (event) => {
|
|
68
|
+
var _a, _b, _c;
|
|
69
|
+
if (event.key !== "Escape") return;
|
|
70
|
+
const over = (_b = (_a = document.activeElement) == null ? void 0 : _a.closest) == null ? void 0 : _b.call(_a, '[role="dialog"]');
|
|
71
|
+
if (over && !((_c = drawer.current) == null ? void 0 : _c.contains(over))) return;
|
|
72
|
+
onClose();
|
|
73
|
+
};
|
|
74
|
+
window.addEventListener("keydown", onKey);
|
|
75
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
76
|
+
}, [onClose, open]);
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
|
+
import_overlay.default,
|
|
80
|
+
{
|
|
81
|
+
...{
|
|
82
|
+
className: "z-30 fixed inset-0",
|
|
83
|
+
onClick: onClose,
|
|
84
|
+
show: open,
|
|
85
|
+
style
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
...{
|
|
93
|
+
"aria-hidden": !open,
|
|
94
|
+
"aria-label": pay ? "Checkout" : "Cart",
|
|
95
|
+
className: "z-40 fixed inset-y-0 right-0 flex flex-col w-full lg:max-w-md bg-white transition-transform duration-300 ease-out " + (open ? "translate-x-0" : "translate-x-full"),
|
|
96
|
+
ref: drawer,
|
|
97
|
+
role: "dialog",
|
|
98
|
+
style: {
|
|
99
|
+
...fonts == null ? void 0 : fonts.body,
|
|
100
|
+
...style && (0, import_styles.backgroundStyle)(style)
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
...{
|
|
107
|
+
className: "p-6 space-y-6 overflow-y-auto hide-scrollbar overflow-x-hidden min-h-0"
|
|
108
|
+
},
|
|
109
|
+
children: pay ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
110
|
+
FormSubdomainCheckout,
|
|
111
|
+
{
|
|
112
|
+
...{
|
|
113
|
+
back: onBack,
|
|
114
|
+
button,
|
|
115
|
+
cart: pay,
|
|
116
|
+
onCart,
|
|
117
|
+
onPaid,
|
|
118
|
+
params,
|
|
119
|
+
preview,
|
|
120
|
+
style
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
pay.id
|
|
124
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
125
|
+
import_form_subdomain_shop_modal.FormSubdomainCart,
|
|
126
|
+
{
|
|
127
|
+
...{
|
|
128
|
+
button,
|
|
129
|
+
cart,
|
|
130
|
+
cut,
|
|
131
|
+
onLineRemove,
|
|
132
|
+
onLineUpdate,
|
|
133
|
+
onOpenProduct,
|
|
134
|
+
onSuccess: ({ result }) => {
|
|
135
|
+
tracking == null ? void 0 : tracking.track({
|
|
136
|
+
name: "shop-checkout",
|
|
137
|
+
data: result
|
|
138
|
+
});
|
|
139
|
+
onCheckout(result);
|
|
140
|
+
},
|
|
141
|
+
style,
|
|
142
|
+
tracking
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] });
|
|
151
|
+
};
|
|
152
|
+
var cart_drawer_default = CartDrawer;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment, useEffect, useRef } from "react";
|
|
4
|
+
import dynamic from "next/dynamic";
|
|
5
|
+
import { FormSubdomainCart } from "./form-subdomain-shop-modal.mjs";
|
|
6
|
+
import Overlay from "../shared/overlay.mjs";
|
|
7
|
+
import { backgroundStyle } from "../styles.mjs";
|
|
8
|
+
const FormSubdomainCheckout = dynamic(() => import("./form-subdomain-checkout.mjs"), { ssr: false });
|
|
9
|
+
const CartDrawer = ({
|
|
10
|
+
button,
|
|
11
|
+
cart,
|
|
12
|
+
cut,
|
|
13
|
+
fonts,
|
|
14
|
+
onBack,
|
|
15
|
+
onCart,
|
|
16
|
+
onCheckout,
|
|
17
|
+
onClose,
|
|
18
|
+
onLineRemove,
|
|
19
|
+
onLineUpdate,
|
|
20
|
+
onOpenProduct,
|
|
21
|
+
onPaid,
|
|
22
|
+
open,
|
|
23
|
+
params,
|
|
24
|
+
pay,
|
|
25
|
+
preview,
|
|
26
|
+
style,
|
|
27
|
+
tracking
|
|
28
|
+
}) => {
|
|
29
|
+
const drawer = useRef(null);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (drawer.current) drawer.current.inert = !open;
|
|
32
|
+
}, [open]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!open) return;
|
|
35
|
+
const onKey = (event) => {
|
|
36
|
+
var _a, _b, _c;
|
|
37
|
+
if (event.key !== "Escape") return;
|
|
38
|
+
const over = (_b = (_a = document.activeElement) == null ? void 0 : _a.closest) == null ? void 0 : _b.call(_a, '[role="dialog"]');
|
|
39
|
+
if (over && !((_c = drawer.current) == null ? void 0 : _c.contains(over))) return;
|
|
40
|
+
onClose();
|
|
41
|
+
};
|
|
42
|
+
window.addEventListener("keydown", onKey);
|
|
43
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
44
|
+
}, [onClose, open]);
|
|
45
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
Overlay,
|
|
48
|
+
{
|
|
49
|
+
...{
|
|
50
|
+
className: "z-30 fixed inset-0",
|
|
51
|
+
onClick: onClose,
|
|
52
|
+
show: open,
|
|
53
|
+
style
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
...{
|
|
61
|
+
"aria-hidden": !open,
|
|
62
|
+
"aria-label": pay ? "Checkout" : "Cart",
|
|
63
|
+
className: "z-40 fixed inset-y-0 right-0 flex flex-col w-full lg:max-w-md bg-white transition-transform duration-300 ease-out " + (open ? "translate-x-0" : "translate-x-full"),
|
|
64
|
+
ref: drawer,
|
|
65
|
+
role: "dialog",
|
|
66
|
+
style: {
|
|
67
|
+
...fonts == null ? void 0 : fonts.body,
|
|
68
|
+
...style && backgroundStyle(style)
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
children: /* @__PURE__ */ jsx(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
...{
|
|
75
|
+
className: "p-6 space-y-6 overflow-y-auto hide-scrollbar overflow-x-hidden min-h-0"
|
|
76
|
+
},
|
|
77
|
+
children: pay ? /* @__PURE__ */ jsx(
|
|
78
|
+
FormSubdomainCheckout,
|
|
79
|
+
{
|
|
80
|
+
...{
|
|
81
|
+
back: onBack,
|
|
82
|
+
button,
|
|
83
|
+
cart: pay,
|
|
84
|
+
onCart,
|
|
85
|
+
onPaid,
|
|
86
|
+
params,
|
|
87
|
+
preview,
|
|
88
|
+
style
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
pay.id
|
|
92
|
+
) : /* @__PURE__ */ jsx(
|
|
93
|
+
FormSubdomainCart,
|
|
94
|
+
{
|
|
95
|
+
...{
|
|
96
|
+
button,
|
|
97
|
+
cart,
|
|
98
|
+
cut,
|
|
99
|
+
onLineRemove,
|
|
100
|
+
onLineUpdate,
|
|
101
|
+
onOpenProduct,
|
|
102
|
+
onSuccess: ({ result }) => {
|
|
103
|
+
tracking == null ? void 0 : tracking.track({
|
|
104
|
+
name: "shop-checkout",
|
|
105
|
+
data: result
|
|
106
|
+
});
|
|
107
|
+
onCheckout(result);
|
|
108
|
+
},
|
|
109
|
+
style,
|
|
110
|
+
tracking
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] });
|
|
119
|
+
};
|
|
120
|
+
var cart_drawer_default = CartDrawer;
|
|
121
|
+
export {
|
|
122
|
+
cart_drawer_default as default
|
|
123
|
+
};
|
package/dist/bridge/fields.js
CHANGED
|
@@ -27,15 +27,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
var fields_exports = {};
|
|
29
29
|
__export(fields_exports, {
|
|
30
|
+
birthdayInputs: () => birthdayInputs,
|
|
31
|
+
birthdayValue: () => birthdayValue,
|
|
30
32
|
components: () => components,
|
|
31
33
|
errors: () => import_fields_validate.errors,
|
|
32
34
|
starred: () => starred,
|
|
35
|
+
tick: () => tick,
|
|
33
36
|
validate: () => import_fields_validate.validators
|
|
34
37
|
});
|
|
35
38
|
module.exports = __toCommonJS(fields_exports);
|
|
36
39
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
var import_react = require("react");
|
|
37
41
|
var import_input_group = __toESM(require("../input-group"));
|
|
38
42
|
var import_input_answer = __toESM(require("../input-answer"));
|
|
43
|
+
var import_input_checkbox = __toESM(require("../input-checkbox"));
|
|
44
|
+
var import_button = __toESM(require("../shared/button"));
|
|
39
45
|
var import_input_name = __toESM(require("../input-name"));
|
|
40
46
|
var import_input_select = __toESM(require("../input-select"));
|
|
41
47
|
var import_input_phone = __toESM(require("../input-phone"));
|
|
@@ -261,6 +267,251 @@ const FieldTextarea = ({
|
|
|
261
267
|
}
|
|
262
268
|
);
|
|
263
269
|
};
|
|
270
|
+
const birthdayValue = ({ day = "", month = "", year = "" } = {}) => !day && !month && !year ? "" : [year, month && String(month).padStart(2, "0"), day && String(day).padStart(2, "0")].join("-");
|
|
271
|
+
const birthdayInputs = (value) => {
|
|
272
|
+
const [year = "", month = "", day = ""] = typeof value === "string" && value ? value.split("-") : [];
|
|
273
|
+
const typed = (part) => /^\d+$/.test(part) ? String(Number(part)) : part;
|
|
274
|
+
return {
|
|
275
|
+
day: typed(day),
|
|
276
|
+
month: typed(month),
|
|
277
|
+
year
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
const FieldBirthday = ({
|
|
281
|
+
error,
|
|
282
|
+
field,
|
|
283
|
+
onChange = () => {
|
|
284
|
+
},
|
|
285
|
+
style,
|
|
286
|
+
value
|
|
287
|
+
}) => {
|
|
288
|
+
const [parts, setParts] = (0, import_react.useState)(() => birthdayInputs(value));
|
|
289
|
+
const box = (key, label) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
290
|
+
"div",
|
|
291
|
+
{
|
|
292
|
+
...{
|
|
293
|
+
className: "space-y-2 w-full"
|
|
294
|
+
},
|
|
295
|
+
children: [
|
|
296
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: label }),
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
298
|
+
import_input_text.default,
|
|
299
|
+
{
|
|
300
|
+
...{
|
|
301
|
+
"aria-label": ((field == null ? void 0 : field.label) ? field.label + ", " : "") + label.toLowerCase(),
|
|
302
|
+
inputMode: "numeric",
|
|
303
|
+
onChange: (text) => {
|
|
304
|
+
const next = {
|
|
305
|
+
...parts,
|
|
306
|
+
[key]: text
|
|
307
|
+
};
|
|
308
|
+
setParts(next);
|
|
309
|
+
onChange(birthdayValue(next));
|
|
310
|
+
},
|
|
311
|
+
style,
|
|
312
|
+
value: parts[key] || ""
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
)
|
|
316
|
+
]
|
|
317
|
+
},
|
|
318
|
+
key
|
|
319
|
+
);
|
|
320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
321
|
+
import_input_group.default,
|
|
322
|
+
{
|
|
323
|
+
...{
|
|
324
|
+
error: error == null ? void 0 : error.message,
|
|
325
|
+
input: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
326
|
+
"div",
|
|
327
|
+
{
|
|
328
|
+
...{
|
|
329
|
+
className: "flex items-center space-x-4 w-full"
|
|
330
|
+
},
|
|
331
|
+
children: [
|
|
332
|
+
box("month", "Month"),
|
|
333
|
+
box("day", "Day"),
|
|
334
|
+
box("year", "Year")
|
|
335
|
+
]
|
|
336
|
+
}
|
|
337
|
+
),
|
|
338
|
+
label: starred(field),
|
|
339
|
+
style
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
);
|
|
343
|
+
};
|
|
344
|
+
const choiceRows = ({ field, picked, pick, round, style }) => {
|
|
345
|
+
var _a;
|
|
346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
347
|
+
"div",
|
|
348
|
+
{
|
|
349
|
+
...{
|
|
350
|
+
className: "space-y-3",
|
|
351
|
+
role: round ? "radiogroup" : "group",
|
|
352
|
+
"aria-label": field == null ? void 0 : field.label
|
|
353
|
+
},
|
|
354
|
+
children: (((_a = field == null ? void 0 : field.settings) == null ? void 0 : _a.options) || []).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
355
|
+
import_input_checkbox.default,
|
|
356
|
+
{
|
|
357
|
+
...{
|
|
358
|
+
label: item == null ? void 0 : item.option,
|
|
359
|
+
labelId: "choice-" + ((field == null ? void 0 : field.id) || "field") + "-" + index,
|
|
360
|
+
onChange: () => pick(item == null ? void 0 : item.option),
|
|
361
|
+
round,
|
|
362
|
+
style,
|
|
363
|
+
value: picked(item == null ? void 0 : item.option)
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
(item == null ? void 0 : item.id) || index
|
|
367
|
+
))
|
|
368
|
+
}
|
|
369
|
+
);
|
|
370
|
+
};
|
|
371
|
+
const FieldRadio = ({
|
|
372
|
+
error,
|
|
373
|
+
field,
|
|
374
|
+
onChange = () => {
|
|
375
|
+
},
|
|
376
|
+
style,
|
|
377
|
+
value
|
|
378
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
379
|
+
import_input_group.default,
|
|
380
|
+
{
|
|
381
|
+
...{
|
|
382
|
+
error: error == null ? void 0 : error.message,
|
|
383
|
+
input: choiceRows({
|
|
384
|
+
field,
|
|
385
|
+
pick: (option) => onChange(option),
|
|
386
|
+
picked: (option) => Boolean(value) && value === option,
|
|
387
|
+
round: true,
|
|
388
|
+
style
|
|
389
|
+
}),
|
|
390
|
+
label: starred(field),
|
|
391
|
+
style
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
const tick = (options = [], value, option) => {
|
|
396
|
+
const ticked = Array.isArray(value) ? value : [];
|
|
397
|
+
const next = ticked.includes(option) ? ticked.filter((item) => item !== option) : [...ticked, option];
|
|
398
|
+
return (options || []).map((item) => item == null ? void 0 : item.option).filter((item) => next.includes(item));
|
|
399
|
+
};
|
|
400
|
+
const FieldCheckbox = ({
|
|
401
|
+
error,
|
|
402
|
+
field,
|
|
403
|
+
onChange = () => {
|
|
404
|
+
},
|
|
405
|
+
style,
|
|
406
|
+
value
|
|
407
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
408
|
+
import_input_group.default,
|
|
409
|
+
{
|
|
410
|
+
...{
|
|
411
|
+
error: error == null ? void 0 : error.message,
|
|
412
|
+
input: choiceRows({
|
|
413
|
+
field,
|
|
414
|
+
pick: (option) => {
|
|
415
|
+
var _a;
|
|
416
|
+
return onChange(tick((_a = field == null ? void 0 : field.settings) == null ? void 0 : _a.options, value, option));
|
|
417
|
+
},
|
|
418
|
+
picked: (option) => Array.isArray(value) && value.includes(option),
|
|
419
|
+
round: false,
|
|
420
|
+
style
|
|
421
|
+
}),
|
|
422
|
+
label: starred(field),
|
|
423
|
+
style
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
const FieldRating = ({
|
|
428
|
+
error,
|
|
429
|
+
field,
|
|
430
|
+
onChange = () => {
|
|
431
|
+
},
|
|
432
|
+
style,
|
|
433
|
+
value
|
|
434
|
+
}) => {
|
|
435
|
+
var _a, _b, _c;
|
|
436
|
+
const max = Number((_a = field == null ? void 0 : field.attributes) == null ? void 0 : _a.max) || 5;
|
|
437
|
+
const low = (_b = field == null ? void 0 : field.settings) == null ? void 0 : _b.low;
|
|
438
|
+
const high = (_c = field == null ? void 0 : field.settings) == null ? void 0 : _c.high;
|
|
439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
440
|
+
import_input_group.default,
|
|
441
|
+
{
|
|
442
|
+
...{
|
|
443
|
+
error: error == null ? void 0 : error.message,
|
|
444
|
+
input: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
445
|
+
"div",
|
|
446
|
+
{
|
|
447
|
+
...{
|
|
448
|
+
className: "space-y-2 w-full"
|
|
449
|
+
},
|
|
450
|
+
children: [
|
|
451
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
452
|
+
"div",
|
|
453
|
+
{
|
|
454
|
+
...{
|
|
455
|
+
"aria-label": field == null ? void 0 : field.label,
|
|
456
|
+
className: "grid w-full gap-1",
|
|
457
|
+
role: "group",
|
|
458
|
+
style: {
|
|
459
|
+
gridTemplateColumns: "repeat(" + max + ", minmax(0, 1fr))"
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
children: Array.from({ length: max }, (_, index) => index + 1).map((number) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
463
|
+
import_button.default,
|
|
464
|
+
{
|
|
465
|
+
...{
|
|
466
|
+
"aria-pressed": Number(value) === number,
|
|
467
|
+
onClick: () => onChange(number),
|
|
468
|
+
variant: "link"
|
|
469
|
+
},
|
|
470
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
471
|
+
"span",
|
|
472
|
+
{
|
|
473
|
+
...{
|
|
474
|
+
className: "flex items-center justify-center w-full h-10 border text-sm tabular-nums",
|
|
475
|
+
style: Number(value) === number ? (0, import_styles.buttonStyle)(style) : (0, import_styles.inputCheckboxStyle)(style)
|
|
476
|
+
},
|
|
477
|
+
children: number
|
|
478
|
+
}
|
|
479
|
+
)
|
|
480
|
+
},
|
|
481
|
+
number
|
|
482
|
+
))
|
|
483
|
+
}
|
|
484
|
+
),
|
|
485
|
+
(low || high) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
486
|
+
"div",
|
|
487
|
+
{
|
|
488
|
+
...{
|
|
489
|
+
className: "flex justify-between gap-4 text-xs",
|
|
490
|
+
...style && { style: (0, import_styles.textStyle)(style) }
|
|
491
|
+
},
|
|
492
|
+
children: [
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: low }),
|
|
494
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
495
|
+
"span",
|
|
496
|
+
{
|
|
497
|
+
...{
|
|
498
|
+
className: "text-right"
|
|
499
|
+
},
|
|
500
|
+
children: high
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
]
|
|
504
|
+
}
|
|
505
|
+
)
|
|
506
|
+
]
|
|
507
|
+
}
|
|
508
|
+
),
|
|
509
|
+
label: starred(field),
|
|
510
|
+
style
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
};
|
|
264
515
|
const FieldSection = ({
|
|
265
516
|
field,
|
|
266
517
|
style
|
|
@@ -325,6 +576,18 @@ const FieldSkill = ({
|
|
|
325
576
|
}
|
|
326
577
|
);
|
|
327
578
|
const components = {
|
|
579
|
+
birthday: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
580
|
+
FieldBirthday,
|
|
581
|
+
{
|
|
582
|
+
...props
|
|
583
|
+
}
|
|
584
|
+
),
|
|
585
|
+
checkbox: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
586
|
+
FieldCheckbox,
|
|
587
|
+
{
|
|
588
|
+
...props
|
|
589
|
+
}
|
|
590
|
+
),
|
|
328
591
|
email: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
329
592
|
FieldEmail,
|
|
330
593
|
{
|
|
@@ -349,6 +612,18 @@ const components = {
|
|
|
349
612
|
...props
|
|
350
613
|
}
|
|
351
614
|
),
|
|
615
|
+
radio: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
616
|
+
FieldRadio,
|
|
617
|
+
{
|
|
618
|
+
...props
|
|
619
|
+
}
|
|
620
|
+
),
|
|
621
|
+
rating: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
622
|
+
FieldRating,
|
|
623
|
+
{
|
|
624
|
+
...props
|
|
625
|
+
}
|
|
626
|
+
),
|
|
352
627
|
section: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
353
628
|
FieldSection,
|
|
354
629
|
{
|
|
@@ -382,8 +657,11 @@ const components = {
|
|
|
382
657
|
};
|
|
383
658
|
// Annotate the CommonJS export names for ESM import in node:
|
|
384
659
|
0 && (module.exports = {
|
|
660
|
+
birthdayInputs,
|
|
661
|
+
birthdayValue,
|
|
385
662
|
components,
|
|
386
663
|
errors,
|
|
387
664
|
starred,
|
|
665
|
+
tick,
|
|
388
666
|
validate
|
|
389
667
|
});
|