@nswds/app 1.114.0 → 1.115.0
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/globals.css +476 -30
- package/dist/index.cjs +261 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +77 -12
- package/dist/index.d.ts +77 -12
- package/dist/index.js +261 -84
- package/dist/index.js.map +1 -1
- package/dist/styles.css +473 -30
- package/dist/styles.css.map +1 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -4231,7 +4231,7 @@ var Link = React5.forwardRef(function Link2({ className, variant, ...props }, re
|
|
|
4231
4231
|
var styles = {
|
|
4232
4232
|
base: [
|
|
4233
4233
|
// Base
|
|
4234
|
-
"relative isolate inline-flex items-baseline justify-center gap-x-2 rounded-sm border text-base/7
|
|
4234
|
+
"relative isolate inline-flex items-baseline justify-center gap-x-2 rounded-sm border text-base/7 font-bold transition-all",
|
|
4235
4235
|
// Focus
|
|
4236
4236
|
"focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-(--btn-bg)",
|
|
4237
4237
|
// Disabled
|
|
@@ -4315,7 +4315,7 @@ var styles = {
|
|
|
4315
4315
|
],
|
|
4316
4316
|
outline: [
|
|
4317
4317
|
// Text color
|
|
4318
|
-
"border-(--btn-bg) text-(--btn-bg)",
|
|
4318
|
+
"border-(--btn-bg) text-(--btn-bg) border-2",
|
|
4319
4319
|
// Optical border, implemented as the button background to avoid corner artifacts
|
|
4320
4320
|
"bg-transparent",
|
|
4321
4321
|
// Button background, implemented as foreground layer to stack on top of pseudo-border layer
|
|
@@ -4476,30 +4476,12 @@ var styles = {
|
|
|
4476
4476
|
"dark:[--btn-bg:var(--color-accent-500)] dark:[--btn-border:var(--color-accent-500)]/90 dark:[--btn-text:white]",
|
|
4477
4477
|
// Dark mode states
|
|
4478
4478
|
"dark:[--btn-hover-overlay:var(--color-accent-500)]/30 dark:data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/10"
|
|
4479
|
-
],
|
|
4480
|
-
danger: [
|
|
4481
|
-
// Base
|
|
4482
|
-
"",
|
|
4483
|
-
// States
|
|
4484
|
-
"",
|
|
4485
|
-
// Dark mode
|
|
4486
|
-
"",
|
|
4487
|
-
// Dark mode states
|
|
4488
|
-
"",
|
|
4489
|
-
// Icon
|
|
4490
|
-
"",
|
|
4491
|
-
// Icon states
|
|
4492
|
-
"",
|
|
4493
|
-
// Icon dark mode
|
|
4494
|
-
"",
|
|
4495
|
-
// Icon dark mode states
|
|
4496
|
-
""
|
|
4497
4479
|
]
|
|
4498
4480
|
},
|
|
4499
4481
|
size: {
|
|
4500
|
-
default: "px-[calc(--spacing(
|
|
4501
|
-
sm: "px-[calc(--spacing(
|
|
4502
|
-
lg: "px-[calc(--spacing(
|
|
4482
|
+
default: "px-[calc(--spacing(6)-1px)] py-[calc(--spacing(4)-1px)] sm:px-[calc(--spacing(5.5)-1px)] sm:py-[calc(--spacing(3)-1px)]",
|
|
4483
|
+
sm: "px-[calc(--spacing(5)-1px)] py-[calc(--spacing(3)-1px)] sm:px-[calc(--spacing(4.5)-1px)] sm:py-[calc(--spacing(2)-1px)]",
|
|
4484
|
+
lg: "px-[calc(--spacing(7)-1px)] py-[calc(--spacing(5)-1px)] sm:px-[calc(--spacing(6.5)-1px)] sm:py-[calc(--spacing(4)-1px)]",
|
|
4503
4485
|
icon: "w-10 h-10 flex-none"
|
|
4504
4486
|
},
|
|
4505
4487
|
iconSize: {
|
|
@@ -4527,8 +4509,7 @@ var buttonVariants = classVarianceAuthority.cva(styles.base, {
|
|
|
4527
4509
|
primary: styles.colors.primary,
|
|
4528
4510
|
secondary: styles.colors.secondary,
|
|
4529
4511
|
tertiary: styles.colors.tertiary,
|
|
4530
|
-
accent: styles.colors.accent
|
|
4531
|
-
danger: styles.colors.danger
|
|
4512
|
+
accent: styles.colors.accent
|
|
4532
4513
|
},
|
|
4533
4514
|
size: {
|
|
4534
4515
|
default: styles.size.default,
|
|
@@ -18835,7 +18816,7 @@ function FormatToggle({ format, setFormat }) {
|
|
|
18835
18816
|
|
|
18836
18817
|
// package.json
|
|
18837
18818
|
var package_default = {
|
|
18838
|
-
version: "1.
|
|
18819
|
+
version: "1.114.1"};
|
|
18839
18820
|
var SluggerContext = React5__namespace.default.createContext(null);
|
|
18840
18821
|
function flattenText(nodes) {
|
|
18841
18822
|
if (nodes == null || typeof nodes === "boolean") return "";
|
|
@@ -19124,9 +19105,107 @@ var heroBannerVariants = classVarianceAuthority.cva("relative", {
|
|
|
19124
19105
|
variants: {
|
|
19125
19106
|
variant: {
|
|
19126
19107
|
"primary-800": "bg-primary-800 text-white",
|
|
19127
|
-
"
|
|
19108
|
+
"primary-600": "bg-primary-600 text-white",
|
|
19109
|
+
"primary-400": "bg-primary-400 text-primary-800",
|
|
19110
|
+
"primary-200": "bg-primary-200 text-primary-800",
|
|
19111
|
+
"grey-800": "bg-grey-800 text-white",
|
|
19112
|
+
"grey-600": "bg-grey-600 text-white",
|
|
19113
|
+
"grey-400": "bg-grey-400 text-grey-800",
|
|
19114
|
+
"grey-200": "bg-grey-200 text-grey-800",
|
|
19128
19115
|
"accent-800": "bg-accent-800 text-white",
|
|
19116
|
+
"accent-600": "bg-accent-600 text-white",
|
|
19117
|
+
"accent-400": "bg-accent-400 text-accent-800",
|
|
19118
|
+
"accent-200": "bg-accent-200 text-accent-800",
|
|
19119
|
+
white: "bg-white text-grey-800"
|
|
19120
|
+
}
|
|
19121
|
+
},
|
|
19122
|
+
defaultVariants: {
|
|
19123
|
+
variant: "primary-800"
|
|
19124
|
+
}
|
|
19125
|
+
});
|
|
19126
|
+
var heroBannerContentAlignments = {
|
|
19127
|
+
center: {
|
|
19128
|
+
content: "text-center",
|
|
19129
|
+
subtitle: "mx-auto",
|
|
19130
|
+
actions: "justify-center"
|
|
19131
|
+
},
|
|
19132
|
+
left: {
|
|
19133
|
+
content: "text-left",
|
|
19134
|
+
subtitle: "",
|
|
19135
|
+
actions: "justify-start"
|
|
19136
|
+
}
|
|
19137
|
+
};
|
|
19138
|
+
function HeroBannerSimple({
|
|
19139
|
+
variant,
|
|
19140
|
+
heading,
|
|
19141
|
+
subtitle,
|
|
19142
|
+
contentAlign = "center",
|
|
19143
|
+
primaryButton,
|
|
19144
|
+
secondaryButton
|
|
19145
|
+
}) {
|
|
19146
|
+
const alignment = heroBannerContentAlignments[contentAlign];
|
|
19147
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: heroBannerVariants({ variant }), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 py-24 sm:py-32 lg:px-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("mx-auto max-w-2xl", alignment.content), children: [
|
|
19148
|
+
heading && /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-4xl font-semibold tracking-tight text-balance sm:text-6xl", children: heading }),
|
|
19149
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("mt-6 max-w-xl text-lg leading-8 text-pretty", alignment.subtitle), children: subtitle }),
|
|
19150
|
+
(primaryButton || secondaryButton) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19151
|
+
"div",
|
|
19152
|
+
{
|
|
19153
|
+
className: cn("mt-10 flex flex-wrap items-center gap-x-6 gap-y-4", alignment.actions),
|
|
19154
|
+
children: [
|
|
19155
|
+
primaryButton && (primaryButton.href ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
19156
|
+
Button2,
|
|
19157
|
+
{
|
|
19158
|
+
href: primaryButton.href,
|
|
19159
|
+
variant: primaryButton.variant,
|
|
19160
|
+
color: primaryButton.color ?? void 0,
|
|
19161
|
+
children: primaryButton.text
|
|
19162
|
+
}
|
|
19163
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
19164
|
+
Button2,
|
|
19165
|
+
{
|
|
19166
|
+
onClick: primaryButton.onClick,
|
|
19167
|
+
variant: primaryButton.variant,
|
|
19168
|
+
color: primaryButton.color ?? void 0,
|
|
19169
|
+
children: primaryButton.text
|
|
19170
|
+
}
|
|
19171
|
+
)),
|
|
19172
|
+
secondaryButton && (secondaryButton.href ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
19173
|
+
Button2,
|
|
19174
|
+
{
|
|
19175
|
+
href: secondaryButton.href,
|
|
19176
|
+
variant: secondaryButton.variant,
|
|
19177
|
+
color: secondaryButton.color ?? void 0,
|
|
19178
|
+
children: secondaryButton.text
|
|
19179
|
+
}
|
|
19180
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
19181
|
+
Button2,
|
|
19182
|
+
{
|
|
19183
|
+
onClick: secondaryButton.onClick,
|
|
19184
|
+
variant: secondaryButton.variant,
|
|
19185
|
+
color: secondaryButton.color ?? void 0,
|
|
19186
|
+
children: secondaryButton.text
|
|
19187
|
+
}
|
|
19188
|
+
))
|
|
19189
|
+
]
|
|
19190
|
+
}
|
|
19191
|
+
)
|
|
19192
|
+
] }) }) });
|
|
19193
|
+
}
|
|
19194
|
+
var heroBannerVariants2 = classVarianceAuthority.cva("relative", {
|
|
19195
|
+
variants: {
|
|
19196
|
+
variant: {
|
|
19197
|
+
"primary-800": "bg-primary-800 text-white",
|
|
19198
|
+
"primary-600": "bg-primary-600 text-white",
|
|
19199
|
+
"primary-400": "bg-primary-400 text-primary-800",
|
|
19129
19200
|
"primary-200": "bg-primary-200 text-primary-800",
|
|
19201
|
+
"grey-800": "bg-grey-800 text-white",
|
|
19202
|
+
"grey-600": "bg-grey-600 text-white",
|
|
19203
|
+
"grey-400": "bg-grey-400 text-grey-800",
|
|
19204
|
+
"grey-200": "bg-grey-200 text-grey-800",
|
|
19205
|
+
"accent-800": "bg-accent-800 text-white",
|
|
19206
|
+
"accent-600": "bg-accent-600 text-white",
|
|
19207
|
+
"accent-400": "bg-accent-400 text-accent-800",
|
|
19208
|
+
"accent-200": "bg-accent-200 text-accent-800",
|
|
19130
19209
|
white: "bg-white text-grey-800"
|
|
19131
19210
|
}
|
|
19132
19211
|
},
|
|
@@ -19134,6 +19213,34 @@ var heroBannerVariants = classVarianceAuthority.cva("relative", {
|
|
|
19134
19213
|
variant: "primary-800"
|
|
19135
19214
|
}
|
|
19136
19215
|
});
|
|
19216
|
+
var HERO_BANNER_SUPPORTING_IMAGE_DEFAULT_SPLIT = {
|
|
19217
|
+
left: 8,
|
|
19218
|
+
right: 4
|
|
19219
|
+
};
|
|
19220
|
+
var HERO_BANNER_SUPPORTING_IMAGE_COLUMN_SPANS = {
|
|
19221
|
+
1: "lg:col-span-1",
|
|
19222
|
+
2: "lg:col-span-2",
|
|
19223
|
+
3: "lg:col-span-3",
|
|
19224
|
+
4: "lg:col-span-4",
|
|
19225
|
+
5: "lg:col-span-5",
|
|
19226
|
+
6: "lg:col-span-6",
|
|
19227
|
+
7: "lg:col-span-7",
|
|
19228
|
+
8: "lg:col-span-8",
|
|
19229
|
+
9: "lg:col-span-9",
|
|
19230
|
+
10: "lg:col-span-10",
|
|
19231
|
+
11: "lg:col-span-11"
|
|
19232
|
+
};
|
|
19233
|
+
function resolveHeroBannerSupportingImageSplit(split) {
|
|
19234
|
+
if (!split) {
|
|
19235
|
+
return HERO_BANNER_SUPPORTING_IMAGE_DEFAULT_SPLIT;
|
|
19236
|
+
}
|
|
19237
|
+
const hasValidLeftSpan = split.left in HERO_BANNER_SUPPORTING_IMAGE_COLUMN_SPANS;
|
|
19238
|
+
const hasValidRightSpan = split.right in HERO_BANNER_SUPPORTING_IMAGE_COLUMN_SPANS;
|
|
19239
|
+
if (hasValidLeftSpan && hasValidRightSpan && split.left + split.right === 12) {
|
|
19240
|
+
return split;
|
|
19241
|
+
}
|
|
19242
|
+
return HERO_BANNER_SUPPORTING_IMAGE_DEFAULT_SPLIT;
|
|
19243
|
+
}
|
|
19137
19244
|
function HeroBannerSupportingImage({
|
|
19138
19245
|
variant,
|
|
19139
19246
|
imgAlt,
|
|
@@ -19141,63 +19248,96 @@ function HeroBannerSupportingImage({
|
|
|
19141
19248
|
imgBgcolor,
|
|
19142
19249
|
heading,
|
|
19143
19250
|
subtitle,
|
|
19251
|
+
split,
|
|
19144
19252
|
primaryButton,
|
|
19145
19253
|
secondaryButton
|
|
19146
19254
|
}) {
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
}
|
|
19160
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
19161
|
-
Button2,
|
|
19162
|
-
{
|
|
19163
|
-
onClick: primaryButton.onClick,
|
|
19164
|
-
variant: primaryButton.variant,
|
|
19165
|
-
color: primaryButton.color ?? void 0,
|
|
19166
|
-
children: primaryButton.text
|
|
19167
|
-
}
|
|
19168
|
-
)),
|
|
19169
|
-
secondaryButton && (secondaryButton.href ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
19170
|
-
Button2,
|
|
19171
|
-
{
|
|
19172
|
-
href: secondaryButton.href,
|
|
19173
|
-
variant: secondaryButton.variant,
|
|
19174
|
-
color: secondaryButton.color ?? void 0,
|
|
19175
|
-
children: secondaryButton.text
|
|
19176
|
-
}
|
|
19177
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
19178
|
-
Button2,
|
|
19255
|
+
const resolvedSplit = resolveHeroBannerSupportingImageSplit(split);
|
|
19256
|
+
const textSpanClassName = HERO_BANNER_SUPPORTING_IMAGE_COLUMN_SPANS[resolvedSplit.left];
|
|
19257
|
+
const imageSpanClassName = HERO_BANNER_SUPPORTING_IMAGE_COLUMN_SPANS[resolvedSplit.right];
|
|
19258
|
+
const imageStart = `${resolvedSplit.left / 12 * 100}%`;
|
|
19259
|
+
const contentMaxWidth = `${Math.min(56, resolvedSplit.left / 8 * 42)}rem`;
|
|
19260
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: heroBannerVariants2({ variant }), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto max-w-7xl lg:grid lg:grid-cols-12 lg:gap-x-8 lg:px-8", children: [
|
|
19261
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19262
|
+
"div",
|
|
19263
|
+
{
|
|
19264
|
+
className: cn("px-6 pt-10 pb-24 sm:pb-32 lg:px-0 lg:pt-24 lg:pb-28", textSpanClassName),
|
|
19265
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19266
|
+
"div",
|
|
19179
19267
|
{
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
|
|
19268
|
+
className: "mx-auto max-w-2xl lg:mx-0 lg:max-w-[var(--hero-copy-max-width)]",
|
|
19269
|
+
style: {
|
|
19270
|
+
"--hero-copy-max-width": contentMaxWidth
|
|
19271
|
+
},
|
|
19272
|
+
children: [
|
|
19273
|
+
heading && /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "mt-24 text-4xl font-semibold tracking-tight text-balance sm:mt-10 sm:text-6xl", children: heading }),
|
|
19274
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-6 text-lg leading-8 text-pretty", children: subtitle }),
|
|
19275
|
+
(primaryButton || secondaryButton) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-10 flex flex-wrap items-center gap-x-6 gap-y-4", children: [
|
|
19276
|
+
primaryButton && (primaryButton.href ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
19277
|
+
Button2,
|
|
19278
|
+
{
|
|
19279
|
+
href: primaryButton.href,
|
|
19280
|
+
variant: primaryButton.variant,
|
|
19281
|
+
color: primaryButton.color ?? void 0,
|
|
19282
|
+
children: primaryButton.text
|
|
19283
|
+
}
|
|
19284
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
19285
|
+
Button2,
|
|
19286
|
+
{
|
|
19287
|
+
onClick: primaryButton.onClick,
|
|
19288
|
+
variant: primaryButton.variant,
|
|
19289
|
+
color: primaryButton.color ?? void 0,
|
|
19290
|
+
children: primaryButton.text
|
|
19291
|
+
}
|
|
19292
|
+
)),
|
|
19293
|
+
secondaryButton && (secondaryButton.href ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
19294
|
+
Button2,
|
|
19295
|
+
{
|
|
19296
|
+
href: secondaryButton.href,
|
|
19297
|
+
variant: secondaryButton.variant,
|
|
19298
|
+
color: secondaryButton.color ?? void 0,
|
|
19299
|
+
children: secondaryButton.text
|
|
19300
|
+
}
|
|
19301
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
19302
|
+
Button2,
|
|
19303
|
+
{
|
|
19304
|
+
onClick: secondaryButton.onClick,
|
|
19305
|
+
variant: secondaryButton.variant,
|
|
19306
|
+
color: secondaryButton.color ?? void 0,
|
|
19307
|
+
children: secondaryButton.text
|
|
19308
|
+
}
|
|
19309
|
+
))
|
|
19310
|
+
] })
|
|
19311
|
+
]
|
|
19184
19312
|
}
|
|
19185
|
-
)
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19189
|
-
|
|
19313
|
+
)
|
|
19314
|
+
}
|
|
19315
|
+
),
|
|
19316
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19317
|
+
"div",
|
|
19190
19318
|
{
|
|
19191
|
-
alt: imgAlt,
|
|
19192
|
-
src: imgSrc || "/placeholder.svg",
|
|
19193
|
-
width: 800,
|
|
19194
|
-
height: 800,
|
|
19195
19319
|
className: cn(
|
|
19196
|
-
"
|
|
19197
|
-
|
|
19320
|
+
"relative lg:-mr-8 xl:absolute xl:inset-y-0 xl:right-0 xl:left-[var(--hero-image-start)] xl:mr-0",
|
|
19321
|
+
imageSpanClassName
|
|
19322
|
+
),
|
|
19323
|
+
style: {
|
|
19324
|
+
"--hero-image-start": imageStart
|
|
19325
|
+
},
|
|
19326
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19327
|
+
Image2__default.default,
|
|
19328
|
+
{
|
|
19329
|
+
alt: imgAlt,
|
|
19330
|
+
src: imgSrc || "/placeholder.svg",
|
|
19331
|
+
width: 800,
|
|
19332
|
+
height: 800,
|
|
19333
|
+
className: cn(
|
|
19334
|
+
"aspect-[3/2] w-full object-cover lg:absolute lg:inset-0 lg:aspect-auto lg:h-full",
|
|
19335
|
+
imgBgcolor
|
|
19336
|
+
)
|
|
19337
|
+
}
|
|
19198
19338
|
)
|
|
19199
19339
|
}
|
|
19200
|
-
)
|
|
19340
|
+
)
|
|
19201
19341
|
] }) });
|
|
19202
19342
|
}
|
|
19203
19343
|
function HoverCard({ ...props }) {
|
|
@@ -33176,7 +33316,7 @@ var Tracker = React5__namespace.default.forwardRef(
|
|
|
33176
33316
|
}
|
|
33177
33317
|
);
|
|
33178
33318
|
Tracker.displayName = "Tracker";
|
|
33179
|
-
var
|
|
33319
|
+
var buttonVariants5 = classVarianceAuthority.cva(
|
|
33180
33320
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
33181
33321
|
{
|
|
33182
33322
|
variants: {
|
|
@@ -33213,7 +33353,7 @@ function Button7({
|
|
|
33213
33353
|
Comp,
|
|
33214
33354
|
{
|
|
33215
33355
|
"data-slot": "button",
|
|
33216
|
-
className: cn(
|
|
33356
|
+
className: cn(buttonVariants5({ variant, size, className })),
|
|
33217
33357
|
...props
|
|
33218
33358
|
}
|
|
33219
33359
|
);
|
|
@@ -35622,6 +35762,23 @@ function Input2({ className, type, ...props }) {
|
|
|
35622
35762
|
}
|
|
35623
35763
|
);
|
|
35624
35764
|
}
|
|
35765
|
+
var sanitizePreviewUrl = (value) => {
|
|
35766
|
+
if (!value) return void 0;
|
|
35767
|
+
const trimmed = value.trim();
|
|
35768
|
+
if (!trimmed) return void 0;
|
|
35769
|
+
const baseOrigin = typeof window !== "undefined" ? window.location.origin : "http://localhost";
|
|
35770
|
+
const hasExplicitScheme = /^[a-zA-Z][a-zA-Z\d+.-]*:/.test(trimmed);
|
|
35771
|
+
const isRelativeUrl = trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("?") || trimmed.startsWith("#");
|
|
35772
|
+
const isBareHostname = !hasExplicitScheme && !isRelativeUrl && /^[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+([/:?#].*)?$/.test(trimmed);
|
|
35773
|
+
try {
|
|
35774
|
+
const parsed = hasExplicitScheme ? new URL(trimmed) : isBareHostname ? new URL(`https://${trimmed}`) : new URL(trimmed, baseOrigin);
|
|
35775
|
+
if (parsed.protocol === "http:" || parsed.protocol === "https:") {
|
|
35776
|
+
return parsed.toString();
|
|
35777
|
+
}
|
|
35778
|
+
} catch {
|
|
35779
|
+
}
|
|
35780
|
+
return void 0;
|
|
35781
|
+
};
|
|
35625
35782
|
var WebPreviewContext = React5.createContext(null);
|
|
35626
35783
|
var useWebPreview = () => {
|
|
35627
35784
|
const context = React5.useContext(WebPreviewContext);
|
|
@@ -35637,11 +35794,21 @@ var WebPreview = ({
|
|
|
35637
35794
|
onUrlChange,
|
|
35638
35795
|
...props
|
|
35639
35796
|
}) => {
|
|
35640
|
-
const
|
|
35797
|
+
const initialUrl = sanitizePreviewUrl(defaultUrl) ?? "";
|
|
35798
|
+
const [url, setUrl] = React5.useState(initialUrl);
|
|
35641
35799
|
const [consoleOpen, setConsoleOpen] = React5.useState(false);
|
|
35642
35800
|
const handleUrlChange = (newUrl) => {
|
|
35643
|
-
|
|
35644
|
-
|
|
35801
|
+
if (!newUrl.trim()) {
|
|
35802
|
+
setUrl("");
|
|
35803
|
+
onUrlChange?.("");
|
|
35804
|
+
return;
|
|
35805
|
+
}
|
|
35806
|
+
const safeUrl = sanitizePreviewUrl(newUrl);
|
|
35807
|
+
if (safeUrl === void 0) {
|
|
35808
|
+
return;
|
|
35809
|
+
}
|
|
35810
|
+
setUrl(safeUrl);
|
|
35811
|
+
onUrlChange?.(safeUrl);
|
|
35645
35812
|
};
|
|
35646
35813
|
const contextValue = {
|
|
35647
35814
|
url,
|
|
@@ -35684,20 +35851,30 @@ var WebPreviewUrl = ({ value, onChange, onKeyDown, ...props }) => {
|
|
|
35684
35851
|
}
|
|
35685
35852
|
);
|
|
35686
35853
|
};
|
|
35687
|
-
var WebPreviewBody = ({
|
|
35854
|
+
var WebPreviewBody = ({
|
|
35855
|
+
className,
|
|
35856
|
+
loading,
|
|
35857
|
+
loadingFallback,
|
|
35858
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
35859
|
+
sandbox: _sandbox,
|
|
35860
|
+
src,
|
|
35861
|
+
...props
|
|
35862
|
+
}) => {
|
|
35688
35863
|
const { url } = useWebPreview();
|
|
35864
|
+
const safeSrc = sanitizePreviewUrl(src ?? url);
|
|
35865
|
+
const resolvedLoadingFallback = loadingFallback ?? loading;
|
|
35689
35866
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
|
|
35690
35867
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
35691
35868
|
"iframe",
|
|
35692
35869
|
{
|
|
35693
35870
|
className: cn("size-full", className),
|
|
35694
35871
|
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-presentation",
|
|
35695
|
-
src:
|
|
35872
|
+
src: safeSrc,
|
|
35696
35873
|
title: "Preview",
|
|
35697
35874
|
...props
|
|
35698
35875
|
}
|
|
35699
35876
|
),
|
|
35700
|
-
|
|
35877
|
+
resolvedLoadingFallback
|
|
35701
35878
|
] });
|
|
35702
35879
|
};
|
|
35703
35880
|
var useIsomorphicLayoutEffect2 = typeof window !== "undefined" ? React5.useLayoutEffect : React5.useEffect;
|
|
@@ -36119,6 +36296,7 @@ exports.FormatToggle = FormatToggle;
|
|
|
36119
36296
|
exports.GenerateInterpolatedColors = GenerateInterpolatedColors;
|
|
36120
36297
|
exports.Header = Header2;
|
|
36121
36298
|
exports.Heading = Heading;
|
|
36299
|
+
exports.HeroBannerSimple = HeroBannerSimple;
|
|
36122
36300
|
exports.HeroBannerSupportingImage = HeroBannerSupportingImage;
|
|
36123
36301
|
exports.HoverCard = HoverCard;
|
|
36124
36302
|
exports.HoverCardContent = HoverCardContent;
|