keystone-design-bootstrap 1.0.63 → 1.0.64
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/design_system/components/DynamicFormFields.d.ts +15 -0
- package/dist/design_system/components/DynamicFormFields.js +5049 -0
- package/dist/design_system/components/DynamicFormFields.js.map +1 -0
- package/dist/design_system/sections/index.d.ts +2 -1
- package/dist/design_system/sections/index.js +78 -31
- package/dist/design_system/sections/index.js.map +1 -1
- package/dist/form-C94A_PX_.d.ts +36 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +78 -31
- package/dist/index.js.map +1 -1
- package/dist/lib/server-api.d.ts +6 -3
- package/dist/lib/server-api.js +4 -0
- package/dist/lib/server-api.js.map +1 -1
- package/dist/{package-ByCAZw9u.d.ts → package-DeHKpQp7.d.ts} +1 -30
- package/dist/tracking/index.d.ts +52 -0
- package/dist/tracking/index.js +175 -0
- package/dist/tracking/index.js.map +1 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +2 -1
- package/src/design_system/components/DynamicFormFields.tsx +100 -24
- package/src/lib/server-api.ts +7 -1
- package/src/types/api/form.ts +7 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { S as Service,
|
|
1
|
+
import { S as Service, P as Package, C as CompanyInformation } from '../../package-DeHKpQp7.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { ComponentProps, ReactNode, FC } from 'react';
|
|
4
4
|
export { Theme } from '../../themes/index.js';
|
|
5
5
|
import { B as BlogPost, a as BlogPostAuthor, d as BlogPostTag } from '../../blog-post-vWzW8yFb.js';
|
|
6
6
|
import { BadgeGroup } from '../elements/index.js';
|
|
7
|
+
import { F as FormDefinition } from '../../form-C94A_PX_.js';
|
|
7
8
|
import { W as WebsitePhotos } from '../../website-photos-Cl1YqAno.js';
|
|
8
9
|
import '../../photos-CmBdWiuZ.js';
|
|
9
10
|
import 'react-aria-components';
|
|
@@ -5988,10 +5988,44 @@ function allFieldsFlat(fields) {
|
|
|
5988
5988
|
}
|
|
5989
5989
|
return out;
|
|
5990
5990
|
}
|
|
5991
|
+
function CheckboxGroup({ field }) {
|
|
5992
|
+
var _a;
|
|
5993
|
+
const [selected, setSelected] = useState8([]);
|
|
5994
|
+
const options = (_a = field.options) != null ? _a : [];
|
|
5995
|
+
const toggle = (value) => {
|
|
5996
|
+
setSelected(
|
|
5997
|
+
(prev) => prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value]
|
|
5998
|
+
);
|
|
5999
|
+
};
|
|
6000
|
+
return /* @__PURE__ */ React18.createElement("fieldset", null, /* @__PURE__ */ React18.createElement("legend", { className: "mb-2 font-body text-sm font-medium text-fg-primary" }, field.label, field.required && /* @__PURE__ */ React18.createElement("span", { className: "ml-1 text-error-500" }, "*")), /* @__PURE__ */ React18.createElement(
|
|
6001
|
+
"input",
|
|
6002
|
+
{
|
|
6003
|
+
type: "hidden",
|
|
6004
|
+
name: field.name,
|
|
6005
|
+
value: selected.join(",")
|
|
6006
|
+
}
|
|
6007
|
+
), /* @__PURE__ */ React18.createElement("div", { className: "grid grid-cols-2 gap-x-8 gap-y-3" }, options.map((opt) => {
|
|
6008
|
+
const id3 = `cbg-${field.name}-${opt.value}`;
|
|
6009
|
+
const checked = selected.includes(opt.value);
|
|
6010
|
+
return /* @__PURE__ */ React18.createElement("div", { key: opt.value, className: "flex items-center gap-3" }, /* @__PURE__ */ React18.createElement(
|
|
6011
|
+
"input",
|
|
6012
|
+
{
|
|
6013
|
+
type: "checkbox",
|
|
6014
|
+
id: id3,
|
|
6015
|
+
checked,
|
|
6016
|
+
onChange: () => toggle(opt.value),
|
|
6017
|
+
className: "h-4 w-4 shrink-0 rounded border-secondary focus:ring-focus-ring"
|
|
6018
|
+
}
|
|
6019
|
+
), /* @__PURE__ */ React18.createElement("label", { htmlFor: id3, className: "font-body text-sm text-tertiary cursor-pointer" }, opt.label));
|
|
6020
|
+
})));
|
|
6021
|
+
}
|
|
5991
6022
|
function renderField(field, index, showCountryCode, selectedCountryPhone, onCountryChange, phoneValues, setPhoneValues, companyName, privacyPolicyUrl, termsOfServiceUrl) {
|
|
5992
6023
|
var _a, _b, _c, _d, _e, _f;
|
|
5993
6024
|
const name = (_a = field.name) != null ? _a : `field-${index}`;
|
|
5994
6025
|
const type = ((_b = field.type) != null ? _b : "text").toString().toLowerCase();
|
|
6026
|
+
if (type === "checkbox_group") {
|
|
6027
|
+
return /* @__PURE__ */ React18.createElement(CheckboxGroup, { key: name, field });
|
|
6028
|
+
}
|
|
5995
6029
|
if (field.type === "hidden") {
|
|
5996
6030
|
const val = (_c = field.value) != null ? _c : "";
|
|
5997
6031
|
return /* @__PURE__ */ React18.createElement("input", { key: name, type: "hidden", name, value: val });
|
|
@@ -6036,11 +6070,7 @@ function renderField(field, index, showCountryCode, selectedCountryPhone, onCoun
|
|
|
6036
6070
|
)
|
|
6037
6071
|
));
|
|
6038
6072
|
}
|
|
6039
|
-
if (field.type === "tel"
|
|
6040
|
-
const countryOptions = countries_default.map((c) => ({
|
|
6041
|
-
label: c.phoneCode.startsWith("+") ? c.phoneCode : `+${c.phoneCode}`,
|
|
6042
|
-
value: c.code
|
|
6043
|
-
}));
|
|
6073
|
+
if (field.type === "tel") {
|
|
6044
6074
|
const country = countries_default.find((c) => c.code === selectedCountryPhone);
|
|
6045
6075
|
const nationalMask = getNationalMask(country);
|
|
6046
6076
|
const value = (_e = phoneValues[name]) != null ? _e : "";
|
|
@@ -6051,35 +6081,52 @@ function renderField(field, index, showCountryCode, selectedCountryPhone, onCoun
|
|
|
6051
6081
|
const formatted = nationalMask ? formatDigitsToMask(digits, nationalMask) : digits;
|
|
6052
6082
|
setPhoneValues((prev) => __spreadProps(__spreadValues({}, prev), { [name]: formatted }));
|
|
6053
6083
|
};
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6084
|
+
if (showCountryCode) {
|
|
6085
|
+
const countryOptions = countries_default.map((c) => ({
|
|
6086
|
+
label: c.phoneCode.startsWith("+") ? c.phoneCode : `+${c.phoneCode}`,
|
|
6087
|
+
value: c.code
|
|
6088
|
+
}));
|
|
6089
|
+
return /* @__PURE__ */ React18.createElement(
|
|
6090
|
+
InputGroup2,
|
|
6091
|
+
{
|
|
6092
|
+
key: name,
|
|
6093
|
+
label: field.label,
|
|
6094
|
+
isRequired: Boolean(field.required),
|
|
6095
|
+
size: "md",
|
|
6096
|
+
leadingAddon: /* @__PURE__ */ React18.createElement(
|
|
6097
|
+
NativeSelect2,
|
|
6098
|
+
{
|
|
6099
|
+
"aria-label": "Country code",
|
|
6100
|
+
value: selectedCountryPhone,
|
|
6101
|
+
onChange: (e) => onCountryChange(e.currentTarget.value),
|
|
6102
|
+
options: countryOptions
|
|
6103
|
+
}
|
|
6104
|
+
)
|
|
6105
|
+
},
|
|
6106
|
+
/* @__PURE__ */ React18.createElement(
|
|
6107
|
+
InputBase3,
|
|
6063
6108
|
{
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6109
|
+
type: "tel",
|
|
6110
|
+
name,
|
|
6111
|
+
value,
|
|
6112
|
+
onChange: handlePhoneChange,
|
|
6113
|
+
placeholder,
|
|
6114
|
+
size: "md"
|
|
6068
6115
|
}
|
|
6069
6116
|
)
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
);
|
|
6117
|
+
);
|
|
6118
|
+
}
|
|
6119
|
+
return /* @__PURE__ */ React18.createElement(InputGroup2, { key: name, label: field.label, isRequired: Boolean(field.required), size: "md" }, /* @__PURE__ */ React18.createElement(
|
|
6120
|
+
InputBase3,
|
|
6121
|
+
{
|
|
6122
|
+
type: "tel",
|
|
6123
|
+
name,
|
|
6124
|
+
value,
|
|
6125
|
+
onChange: handlePhoneChange,
|
|
6126
|
+
placeholder,
|
|
6127
|
+
size: "md"
|
|
6128
|
+
}
|
|
6129
|
+
));
|
|
6083
6130
|
}
|
|
6084
6131
|
if (field.type === "textarea") {
|
|
6085
6132
|
return /* @__PURE__ */ React18.createElement(
|