keystone-design-bootstrap 1.0.62 → 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-CB1tENyG.d.ts → package-DeHKpQp7.d.ts} +3 -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/next/legal/privacy-policy.tsx +4 -8
- package/src/next/legal/terms-of-service.tsx +4 -8
- package/src/types/api/company-information.ts +2 -0
- package/src/types/api/form.ts +7 -0
- package/src/next/legal/privacy-policy.default.ts +0 -95
- package/src/next/legal/terms-of-service.default.ts +0 -80
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form definition from API (GET /public/forms/:form_type).
|
|
3
|
+
* fields is an ordered array; each item is a single field or an array of fields (inline row). Max depth 2.
|
|
4
|
+
*/
|
|
5
|
+
interface FormFieldOption {
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}
|
|
9
|
+
interface FormFieldDefinition {
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
label: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
/** For hidden fields, optional value to submit. */
|
|
16
|
+
value?: string;
|
|
17
|
+
/** For checkbox_group fields: the selectable options. */
|
|
18
|
+
options?: FormFieldOption[];
|
|
19
|
+
}
|
|
20
|
+
/** One item in the fields array: either a single field or a row of fields (inline). */
|
|
21
|
+
type FormFieldItem = FormFieldDefinition | FormFieldDefinition[];
|
|
22
|
+
interface FormDefinition {
|
|
23
|
+
id: number;
|
|
24
|
+
name: string;
|
|
25
|
+
form_type: string;
|
|
26
|
+
/** Ordered array; each element is a field or an array of fields (inline row). */
|
|
27
|
+
fields: FormFieldItem[];
|
|
28
|
+
settings?: Record<string, unknown>;
|
|
29
|
+
/** Business name for consent copy (e.g. "{{company_name}}" in checkbox labels). */
|
|
30
|
+
company_name?: string;
|
|
31
|
+
created_at?: string;
|
|
32
|
+
updated_at?: string;
|
|
33
|
+
}
|
|
34
|
+
type FormType = 'lead' | 'job_application' | 'marketing_list_signup';
|
|
35
|
+
|
|
36
|
+
export type { FormDefinition as F, FormFieldDefinition as a, FormFieldItem as b, FormFieldOption as c, FormType as d };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export { AboutHome, BlogCardFullWidthHorizontal, BlogCardFullWidthHorizontalAlt, BlogCardFullWidthHorizontalCompact, BlogCardFullWidthHorizontalMinimal, BlogCardFullWidthVertical, BlogCardFullWidthVerticalAlt, BlogCardFullWidthVerticalCompact, BlogCardFullWidthVerticalMinimal, BlogCardHorizontal, BlogCardHorizontalBadge, BlogCardHorizontalCompact, BlogCardHorizontalMinimal, BlogCardVertical, BlogCardVerticalBadge, BlogCardVerticalCompact, BlogCardVerticalMinimal, BlogGallery, BlogHome, BlogPostSection, BlogSection, ContactHome, ContactSection, EmailSignupSection, EmailSignupSectionProps, FAQGrid, FAQHero, FAQHome, FeatureTabHorizontal, FeatureTabVertical, FeatureTextCentered, FeatureTextFeaturedIconBox, FeatureTextFeaturedIconCard, FeatureTextFeaturedIconLeft, FeatureTextFeaturedIconTopCentered, FeatureTextFeaturedIconTopCenteredBrand, FeatureTextFeaturedIconTopLeft, FeatureTextFeaturedIconTopLeftBrand, FeatureTextIconCard, FeatureTextIconLeft, FeatureTextIconTopCentered, FeatureTextIconTopLeft, FeatureTextIntegrationIconBox, FeatureTextIntegrationIconLeft, FeatureTextIntegrationIconTopCentered, FeatureTextIntegrationIconTopLeft, FeatureTextLeft, FeatureTextLeftBrand, FooterHome, GenericHeaderComponent, GenericTextHero, HeaderNavigation, HeroHome, HomeHeroComponent, JobApplicationForm, JobDetailHero, JobDetailSection, JobGallery, LocationDetailHero, LocationDetailsSection, LocationGrid, PackageForMenu, PolicyDocumentSection, ServiceDetailContent, ServiceDetailHero, ServiceMenuSection, ServiceMenuSectionProps, ServicesGrid, ServicesHome, SocialMediaGrid, SocialMediaHero, StatisticsSection, TeamGrid, TestimonialsGrid, TestimonialsHero, TestimonialsHome, ValuesSection, getBlogPostData } from './design_system/sections/index.js';
|
|
2
2
|
export { Avatar, AvatarLabelGroup, Badge, BadgeGroup, BadgeWithDot, Breadcrumb, Button, ButtonGroup, Carousel, CarouselContext, CarouselSectionWrapper, ComboBox, FeaturedIcon, Form, FormContainer, GoogleMap, HintText, Input, InputBase, InputGroup, Label, MarkdownRenderer, Modal, ModalProps, NativeSelect, Pagination, PaginationPageDefault, PaginationPageMinimalCenter, PhotoWithFallback, PrivacyCheckbox, RatingBadge, RatingStars, RoundButton, Select, SelectItem, SocialIcon, StarIcon, Textarea, Tooltip, VerifiedTick, VideoModal, VideoPlayButton, Wreath, getSocialIcon, getStarProgress, useCarousel } from './design_system/elements/index.js';
|
|
3
|
-
import { C as CompanyInformation } from './package-
|
|
3
|
+
import { C as CompanyInformation } from './package-DeHKpQp7.js';
|
|
4
4
|
export { ThemeProvider, useTheme } from './contexts/index.js';
|
|
5
5
|
import React__default from 'react';
|
|
6
6
|
export { Theme } from './themes/index.js';
|
|
7
7
|
import './blog-post-vWzW8yFb.js';
|
|
8
8
|
import './photos-CmBdWiuZ.js';
|
|
9
|
+
import './form-C94A_PX_.js';
|
|
9
10
|
import './website-photos-Cl1YqAno.js';
|
|
10
11
|
import 'react-aria-components';
|
|
11
12
|
import 'embla-carousel-react';
|
package/dist/index.js
CHANGED
|
@@ -6014,10 +6014,44 @@ function allFieldsFlat(fields) {
|
|
|
6014
6014
|
}
|
|
6015
6015
|
return out;
|
|
6016
6016
|
}
|
|
6017
|
+
function CheckboxGroup({ field }) {
|
|
6018
|
+
var _a;
|
|
6019
|
+
const [selected, setSelected] = useState8([]);
|
|
6020
|
+
const options = (_a = field.options) != null ? _a : [];
|
|
6021
|
+
const toggle = (value) => {
|
|
6022
|
+
setSelected(
|
|
6023
|
+
(prev) => prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value]
|
|
6024
|
+
);
|
|
6025
|
+
};
|
|
6026
|
+
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(
|
|
6027
|
+
"input",
|
|
6028
|
+
{
|
|
6029
|
+
type: "hidden",
|
|
6030
|
+
name: field.name,
|
|
6031
|
+
value: selected.join(",")
|
|
6032
|
+
}
|
|
6033
|
+
), /* @__PURE__ */ React18.createElement("div", { className: "grid grid-cols-2 gap-x-8 gap-y-3" }, options.map((opt) => {
|
|
6034
|
+
const id3 = `cbg-${field.name}-${opt.value}`;
|
|
6035
|
+
const checked = selected.includes(opt.value);
|
|
6036
|
+
return /* @__PURE__ */ React18.createElement("div", { key: opt.value, className: "flex items-center gap-3" }, /* @__PURE__ */ React18.createElement(
|
|
6037
|
+
"input",
|
|
6038
|
+
{
|
|
6039
|
+
type: "checkbox",
|
|
6040
|
+
id: id3,
|
|
6041
|
+
checked,
|
|
6042
|
+
onChange: () => toggle(opt.value),
|
|
6043
|
+
className: "h-4 w-4 shrink-0 rounded border-secondary focus:ring-focus-ring"
|
|
6044
|
+
}
|
|
6045
|
+
), /* @__PURE__ */ React18.createElement("label", { htmlFor: id3, className: "font-body text-sm text-tertiary cursor-pointer" }, opt.label));
|
|
6046
|
+
})));
|
|
6047
|
+
}
|
|
6017
6048
|
function renderField(field, index, showCountryCode, selectedCountryPhone, onCountryChange, phoneValues, setPhoneValues, companyName, privacyPolicyUrl, termsOfServiceUrl) {
|
|
6018
6049
|
var _a, _b, _c, _d, _e, _f;
|
|
6019
6050
|
const name = (_a = field.name) != null ? _a : `field-${index}`;
|
|
6020
6051
|
const type = ((_b = field.type) != null ? _b : "text").toString().toLowerCase();
|
|
6052
|
+
if (type === "checkbox_group") {
|
|
6053
|
+
return /* @__PURE__ */ React18.createElement(CheckboxGroup, { key: name, field });
|
|
6054
|
+
}
|
|
6021
6055
|
if (field.type === "hidden") {
|
|
6022
6056
|
const val = (_c = field.value) != null ? _c : "";
|
|
6023
6057
|
return /* @__PURE__ */ React18.createElement("input", { key: name, type: "hidden", name, value: val });
|
|
@@ -6062,11 +6096,7 @@ function renderField(field, index, showCountryCode, selectedCountryPhone, onCoun
|
|
|
6062
6096
|
)
|
|
6063
6097
|
));
|
|
6064
6098
|
}
|
|
6065
|
-
if (field.type === "tel"
|
|
6066
|
-
const countryOptions = countries_default.map((c) => ({
|
|
6067
|
-
label: c.phoneCode.startsWith("+") ? c.phoneCode : `+${c.phoneCode}`,
|
|
6068
|
-
value: c.code
|
|
6069
|
-
}));
|
|
6099
|
+
if (field.type === "tel") {
|
|
6070
6100
|
const country = countries_default.find((c) => c.code === selectedCountryPhone);
|
|
6071
6101
|
const nationalMask = getNationalMask(country);
|
|
6072
6102
|
const value = (_e = phoneValues[name]) != null ? _e : "";
|
|
@@ -6077,35 +6107,52 @@ function renderField(field, index, showCountryCode, selectedCountryPhone, onCoun
|
|
|
6077
6107
|
const formatted = nationalMask ? formatDigitsToMask(digits, nationalMask) : digits;
|
|
6078
6108
|
setPhoneValues((prev) => __spreadProps(__spreadValues({}, prev), { [name]: formatted }));
|
|
6079
6109
|
};
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6110
|
+
if (showCountryCode) {
|
|
6111
|
+
const countryOptions = countries_default.map((c) => ({
|
|
6112
|
+
label: c.phoneCode.startsWith("+") ? c.phoneCode : `+${c.phoneCode}`,
|
|
6113
|
+
value: c.code
|
|
6114
|
+
}));
|
|
6115
|
+
return /* @__PURE__ */ React18.createElement(
|
|
6116
|
+
InputGroup2,
|
|
6117
|
+
{
|
|
6118
|
+
key: name,
|
|
6119
|
+
label: field.label,
|
|
6120
|
+
isRequired: Boolean(field.required),
|
|
6121
|
+
size: "md",
|
|
6122
|
+
leadingAddon: /* @__PURE__ */ React18.createElement(
|
|
6123
|
+
NativeSelect2,
|
|
6124
|
+
{
|
|
6125
|
+
"aria-label": "Country code",
|
|
6126
|
+
value: selectedCountryPhone,
|
|
6127
|
+
onChange: (e) => onCountryChange(e.currentTarget.value),
|
|
6128
|
+
options: countryOptions
|
|
6129
|
+
}
|
|
6130
|
+
)
|
|
6131
|
+
},
|
|
6132
|
+
/* @__PURE__ */ React18.createElement(
|
|
6133
|
+
InputBase3,
|
|
6089
6134
|
{
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6135
|
+
type: "tel",
|
|
6136
|
+
name,
|
|
6137
|
+
value,
|
|
6138
|
+
onChange: handlePhoneChange,
|
|
6139
|
+
placeholder,
|
|
6140
|
+
size: "md"
|
|
6094
6141
|
}
|
|
6095
6142
|
)
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
);
|
|
6143
|
+
);
|
|
6144
|
+
}
|
|
6145
|
+
return /* @__PURE__ */ React18.createElement(InputGroup2, { key: name, label: field.label, isRequired: Boolean(field.required), size: "md" }, /* @__PURE__ */ React18.createElement(
|
|
6146
|
+
InputBase3,
|
|
6147
|
+
{
|
|
6148
|
+
type: "tel",
|
|
6149
|
+
name,
|
|
6150
|
+
value,
|
|
6151
|
+
onChange: handlePhoneChange,
|
|
6152
|
+
placeholder,
|
|
6153
|
+
size: "md"
|
|
6154
|
+
}
|
|
6155
|
+
));
|
|
6109
6156
|
}
|
|
6110
6157
|
if (field.type === "textarea") {
|
|
6111
6158
|
return /* @__PURE__ */ React18.createElement(
|