@hellboy/ds 0.1.3 → 0.2.7
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/README.md +512 -162
- package/{src/style/components/badge → dist/components}/badge.css +9 -25
- package/dist/components/badge.d.mts +12 -0
- package/dist/components/badge.d.ts +12 -0
- package/dist/components/badge.js +42 -0
- package/dist/components/badge.mjs +15 -0
- package/dist/components/banner.css +280 -0
- package/dist/components/banner.d.mts +12 -0
- package/dist/components/banner.d.ts +12 -0
- package/dist/components/banner.js +184 -0
- package/dist/components/banner.mjs +147 -0
- package/dist/components/button-group.css +289 -0
- package/dist/components/button-group.d.mts +81 -0
- package/dist/components/button-group.d.ts +81 -0
- package/dist/components/button-group.js +180 -0
- package/dist/components/button-group.mjs +143 -0
- package/{src/style/components/button → dist/components}/button.css +59 -62
- package/dist/components/button.d.mts +57 -0
- package/dist/components/button.d.ts +57 -0
- package/dist/components/button.js +129 -0
- package/dist/components/button.mjs +92 -0
- package/{src/style/components/card → dist/components}/card.css +9 -30
- package/dist/components/card.d.mts +31 -0
- package/dist/components/card.d.ts +31 -0
- package/dist/components/card.js +59 -0
- package/dist/components/card.mjs +32 -0
- package/{src/style → dist}/components/checkbox.css +51 -43
- package/dist/components/checkbox.d.mts +31 -0
- package/dist/components/checkbox.d.ts +31 -0
- package/dist/components/checkbox.js +130 -0
- package/dist/components/checkbox.mjs +93 -0
- package/{src/style/components/code-block → dist/components}/code-block.css +3 -7
- package/dist/components/code-block.d.mts +24 -0
- package/dist/components/code-block.d.ts +24 -0
- package/dist/components/code-block.js +43 -0
- package/dist/components/code-block.mjs +16 -0
- package/dist/components/color-control.css +285 -0
- package/dist/components/color-control.d.mts +5 -0
- package/dist/components/color-control.d.ts +5 -0
- package/dist/components/color-control.js +534 -0
- package/dist/components/color-control.mjs +497 -0
- package/dist/components/dialog.css +930 -0
- package/dist/components/dialog.d.mts +32 -0
- package/dist/components/dialog.d.ts +32 -0
- package/dist/components/dialog.js +1111 -0
- package/dist/components/dialog.mjs +1074 -0
- package/dist/components/divider.css +356 -0
- package/dist/components/divider.d.mts +32 -0
- package/dist/components/divider.d.ts +32 -0
- package/dist/components/divider.js +344 -0
- package/dist/components/divider.mjs +307 -0
- package/{src/style/components/drag-handle → dist/components}/drag-handle.css +3 -18
- package/dist/components/drag-handle.d.mts +11 -0
- package/dist/components/drag-handle.d.ts +11 -0
- package/dist/components/drag-handle.js +103 -0
- package/dist/components/drag-handle.mjs +66 -0
- package/dist/components/drawer.css +1027 -0
- package/dist/components/drawer.d.mts +14 -0
- package/dist/components/drawer.d.ts +14 -0
- package/dist/components/drawer.js +1072 -0
- package/dist/components/drawer.mjs +1035 -0
- package/dist/components/floating-bar.css +17 -0
- package/dist/components/floating-bar.d.mts +25 -0
- package/dist/components/floating-bar.d.ts +25 -0
- package/dist/components/floating-bar.js +52 -0
- package/dist/components/floating-bar.mjs +25 -0
- package/dist/components/footer.css +40 -0
- package/dist/components/footer.d.mts +8 -0
- package/dist/components/footer.d.ts +8 -0
- package/dist/components/footer.js +44 -0
- package/dist/components/footer.mjs +17 -0
- package/dist/components/grid.css +47 -0
- package/dist/components/grid.d.mts +27 -0
- package/dist/components/grid.d.ts +27 -0
- package/dist/components/grid.js +52 -0
- package/dist/components/grid.mjs +25 -0
- package/dist/components/header.css +1075 -0
- package/dist/components/header.d.mts +35 -0
- package/dist/components/header.d.ts +35 -0
- package/dist/components/header.js +1402 -0
- package/dist/components/header.mjs +1365 -0
- package/dist/components/hero.css +121 -0
- package/dist/components/hero.d.mts +111 -0
- package/dist/components/hero.d.ts +111 -0
- package/dist/components/hero.js +285 -0
- package/dist/components/hero.mjs +248 -0
- package/{src/style/components/icons → dist/components}/icons.css +14 -15
- package/dist/components/icons.d.mts +104 -0
- package/dist/components/icons.d.ts +104 -0
- package/dist/components/icons.js +239 -0
- package/dist/components/icons.mjs +203 -0
- package/{src/style/components/input → dist/components}/input.css +189 -102
- package/dist/components/input.d.mts +114 -0
- package/dist/components/input.d.ts +114 -0
- package/dist/components/input.js +926 -0
- package/dist/components/input.mjs +879 -0
- package/dist/components/layout.css +551 -0
- package/dist/components/layout.d.mts +16 -0
- package/dist/components/layout.d.ts +16 -0
- package/dist/components/layout.js +387 -0
- package/dist/components/layout.mjs +352 -0
- package/{src/style/components/list → dist/components}/list.css +47 -41
- package/dist/components/list.d.mts +46 -0
- package/dist/components/list.d.ts +46 -0
- package/dist/components/list.js +124 -0
- package/dist/components/list.mjs +96 -0
- package/dist/components/navbar.css +706 -0
- package/dist/components/navbar.d.mts +56 -0
- package/dist/components/navbar.d.ts +56 -0
- package/dist/components/navbar.js +994 -0
- package/dist/components/navbar.mjs +952 -0
- package/{src/style/components/page-index → dist/components}/page-index.css +2 -47
- package/dist/components/page-index.d.mts +25 -0
- package/dist/components/page-index.d.ts +25 -0
- package/dist/components/page-index.js +239 -0
- package/dist/components/page-index.mjs +202 -0
- package/{src/style/components/page → dist/components}/page.css +4 -15
- package/dist/components/page.d.mts +30 -0
- package/dist/components/page.d.ts +30 -0
- package/dist/components/page.js +40 -0
- package/dist/components/page.mjs +13 -0
- package/dist/components/popover.css +87 -0
- package/dist/components/popover.d.mts +22 -0
- package/dist/components/popover.d.ts +22 -0
- package/dist/components/popover.js +243 -0
- package/dist/components/popover.mjs +206 -0
- package/{src/style → dist}/components/radio.css +8 -51
- package/dist/components/radio.d.mts +59 -0
- package/dist/components/radio.d.ts +59 -0
- package/dist/components/radio.js +133 -0
- package/dist/components/radio.mjs +95 -0
- package/dist/components/section.css +993 -0
- package/dist/components/section.d.mts +33 -0
- package/dist/components/section.d.ts +33 -0
- package/dist/components/section.js +1401 -0
- package/dist/components/section.mjs +1364 -0
- package/dist/components/select.css +391 -0
- package/dist/components/select.d.mts +63 -0
- package/dist/components/select.d.ts +63 -0
- package/dist/components/select.js +452 -0
- package/dist/components/select.mjs +415 -0
- package/{src/style/components/slider → dist/components}/slider.css +55 -33
- package/dist/components/slider.d.mts +69 -0
- package/dist/components/slider.d.ts +69 -0
- package/dist/components/slider.js +254 -0
- package/dist/components/slider.mjs +217 -0
- package/dist/components/switch.css +1081 -0
- package/dist/components/switch.d.mts +33 -0
- package/dist/components/switch.d.ts +33 -0
- package/dist/components/switch.js +1092 -0
- package/dist/components/switch.mjs +1055 -0
- package/{src/style/components/table → dist/components}/table.css +3 -28
- package/dist/components/table.d.mts +42 -0
- package/dist/components/table.d.ts +42 -0
- package/dist/components/table.js +108 -0
- package/dist/components/table.mjs +76 -0
- package/dist/components/tag.css +97 -0
- package/dist/components/tag.d.mts +12 -0
- package/dist/components/tag.d.ts +12 -0
- package/dist/components/tag.js +42 -0
- package/dist/components/tag.mjs +15 -0
- package/dist/components/textarea.css +1359 -0
- package/dist/components/textarea.d.mts +84 -0
- package/dist/components/textarea.d.ts +84 -0
- package/dist/components/textarea.js +1962 -0
- package/dist/components/textarea.mjs +1924 -0
- package/{src/style/components/theme-control → dist/components}/theme-control.css +3 -7
- package/dist/components/theme-control.d.mts +9 -0
- package/dist/components/theme-control.d.ts +9 -0
- package/dist/components/theme-control.js +235 -0
- package/dist/components/theme-control.mjs +200 -0
- package/{src/style/components/tooltip → dist/components}/tooltip.css +5 -13
- package/dist/components/tooltip.d.mts +12 -0
- package/dist/components/tooltip.d.ts +12 -0
- package/dist/components/tooltip.js +200 -0
- package/dist/components/tooltip.mjs +163 -0
- package/dist/icons-Czahnf-r.d.mts +15 -0
- package/dist/icons-Czahnf-r.d.ts +15 -0
- package/dist/index.css +2914 -2067
- package/dist/index.d.mts +144 -721
- package/dist/index.d.ts +144 -721
- package/dist/index.js +4076 -2282
- package/dist/index.mjs +4132 -2366
- package/dist/theme.css +34 -34
- package/package.json +27 -8
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/hellboy-ds-0.1.2.tgz +0 -0
- package/src/components/badge/Badge.tsx +0 -29
- package/src/components/badge/index.ts +0 -1
- package/src/components/banner/Banner.tsx +0 -48
- package/src/components/banner/banner.css +0 -44
- package/src/components/banner/index.ts +0 -1
- package/src/components/button/button.tsx +0 -127
- package/src/components/button/index.ts +0 -1
- package/src/components/card/card.tsx +0 -57
- package/src/components/card/index.ts +0 -1
- package/src/components/checkbox/Checkbox.tsx +0 -98
- package/src/components/checkbox/index.ts +0 -1
- package/src/components/code-block/code-block.tsx +0 -44
- package/src/components/code-block/index.ts +0 -1
- package/src/components/color-control/color-control.tsx +0 -322
- package/src/components/color-control/index.ts +0 -1
- package/src/components/drag-handle/DragHandle.tsx +0 -78
- package/src/components/drag-handle/index.ts +0 -1
- package/src/components/drawer/drawer.tsx +0 -82
- package/src/components/drawer/index.ts +0 -1
- package/src/components/floating-bar/floating-bar.tsx +0 -52
- package/src/components/floating-bar/index.ts +0 -2
- package/src/components/footer/footer.tsx +0 -28
- package/src/components/footer/index.ts +0 -1
- package/src/components/grid/Grid.tsx +0 -53
- package/src/components/grid/index.ts +0 -1
- package/src/components/header/header.tsx +0 -57
- package/src/components/header/index.ts +0 -1
- package/src/components/icons/icons.tsx +0 -44
- package/src/components/icons/index.ts +0 -1
- package/src/components/index.ts +0 -29
- package/src/components/input/DatePicker.tsx +0 -133
- package/src/components/input/Input.tsx +0 -220
- package/src/components/input/InputDate.tsx +0 -10
- package/src/components/input/InputDateTime.tsx +0 -10
- package/src/components/input/InputEmail.tsx +0 -10
- package/src/components/input/InputField.tsx +0 -137
- package/src/components/input/InputNumber.tsx +0 -10
- package/src/components/input/InputPassword.tsx +0 -10
- package/src/components/input/InputSearch.tsx +0 -10
- package/src/components/input/InputTel.tsx +0 -10
- package/src/components/input/InputText.tsx +0 -10
- package/src/components/input/InputTime.tsx +0 -10
- package/src/components/input/InputUrl.tsx +0 -10
- package/src/components/input/TimePicker.tsx +0 -151
- package/src/components/input/index.ts +0 -11
- package/src/components/layout/Layout.tsx +0 -244
- package/src/components/layout/index.ts +0 -1
- package/src/components/list/List.tsx +0 -159
- package/src/components/list/index.ts +0 -1
- package/src/components/navbar/MenuCategory.tsx +0 -20
- package/src/components/navbar/MenuGroup.tsx +0 -288
- package/src/components/navbar/MenuItem.tsx +0 -65
- package/src/components/navbar/Navbar.tsx +0 -23
- package/src/components/navbar/index.ts +0 -4
- package/src/components/page/index.ts +0 -1
- package/src/components/page/page.tsx +0 -46
- package/src/components/page-index/PageIndex.tsx +0 -275
- package/src/components/page-index/index.ts +0 -1
- package/src/components/popover/index.ts +0 -1
- package/src/components/popover/popover.tsx +0 -199
- package/src/components/radio/Radio.tsx +0 -176
- package/src/components/radio/index.ts +0 -1
- package/src/components/section/index.ts +0 -1
- package/src/components/section/section.tsx +0 -66
- package/src/components/select/Select.tsx +0 -212
- package/src/components/select/index.ts +0 -1
- package/src/components/slider/Slider.tsx +0 -267
- package/src/components/slider/index.ts +0 -1
- package/src/components/switch/index.ts +0 -1
- package/src/components/switch/switch.tsx +0 -99
- package/src/components/table/Table.tsx +0 -147
- package/src/components/table/index.ts +0 -1
- package/src/components/theme-control/index.ts +0 -1
- package/src/components/theme-control/theme-control.tsx +0 -78
- package/src/components/tooltip/index.ts +0 -1
- package/src/components/tooltip/tooltip.tsx +0 -207
- package/src/contexts/NavbarTooltipContext.tsx +0 -48
- package/src/contexts/index.ts +0 -1
- package/src/foundations/motion.md +0 -136
- package/src/index.ts +0 -40
- package/src/style/_shared/field.css +0 -69
- package/src/style/components/color-control/color-control.css +0 -126
- package/src/style/components/drawer/drawer.css +0 -210
- package/src/style/components/floating-bar/floating-bar.css +0 -39
- package/src/style/components/footer/footer.css +0 -108
- package/src/style/components/grid/grid.css +0 -33
- package/src/style/components/header/header.css +0 -44
- package/src/style/components/layout/layout.css +0 -205
- package/src/style/components/navbar/navbar.css +0 -342
- package/src/style/components/popover/popover.css +0 -44
- package/src/style/components/section/section.css +0 -67
- package/src/style/components/select/select.css +0 -143
- package/src/style/components/switch/switch.css +0 -267
- package/src/style/foundations/global.css +0 -316
- package/src/style/foundations/motion.css +0 -164
- package/src/style/foundations/spacing.css +0 -51
- package/src/style/foundations/typography.css +0 -39
- package/src/style/foundations/z-index.css +0 -81
- package/src/style/modes/dark.css +0 -146
- package/src/style/modes/light.css +0 -147
- package/src/style/semantic.css +0 -52
- package/src/style/styles.css +0 -51
- package/src/style/themes/theme.json +0 -37
- package/src/utils/README.md +0 -305
- package/src/utils/USER_PREFERENCES.md +0 -558
- package/src/utils/theme.ts +0 -127
- package/src/utils/user-preferences.ts +0 -577
- package/tsconfig.json +0 -25
- package/tsup.config.ts +0 -52
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* src/style/components/hero/hero.css */
|
|
2
|
+
.hero {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: flex;
|
|
5
|
+
width: 100%;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
background-repeat: no-repeat;
|
|
8
|
+
}
|
|
9
|
+
.hero__background {
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 0;
|
|
12
|
+
left: 0;
|
|
13
|
+
right: 0;
|
|
14
|
+
bottom: 0;
|
|
15
|
+
background-repeat: no-repeat;
|
|
16
|
+
background-size: cover;
|
|
17
|
+
z-index: 0;
|
|
18
|
+
will-change: background-position;
|
|
19
|
+
}
|
|
20
|
+
.hero__overlay {
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 0;
|
|
23
|
+
left: 0;
|
|
24
|
+
right: 0;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
background:
|
|
27
|
+
linear-gradient(
|
|
28
|
+
0deg,
|
|
29
|
+
var(--color-accent) 0%,
|
|
30
|
+
rgba(0, 0, 0, 0) 30%,
|
|
31
|
+
rgba(0, 0, 0, 0) 100%);
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
z-index: 1;
|
|
34
|
+
}
|
|
35
|
+
.hero__content {
|
|
36
|
+
position: relative;
|
|
37
|
+
z-index: 2;
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
width: 100%;
|
|
41
|
+
max-width: var(--container-max-width, 1200px);
|
|
42
|
+
margin: 0 auto;
|
|
43
|
+
padding: var(--spacing-8);
|
|
44
|
+
gap: var(--spacing-4);
|
|
45
|
+
}
|
|
46
|
+
.hero--align-left .hero__content {
|
|
47
|
+
align-items: flex-start;
|
|
48
|
+
text-align: left;
|
|
49
|
+
}
|
|
50
|
+
.hero--align-center .hero__content {
|
|
51
|
+
align-items: center;
|
|
52
|
+
text-align: center;
|
|
53
|
+
}
|
|
54
|
+
.hero--align-right .hero__content {
|
|
55
|
+
align-items: flex-end;
|
|
56
|
+
text-align: right;
|
|
57
|
+
}
|
|
58
|
+
.hero--vertical-top {
|
|
59
|
+
align-items: flex-start;
|
|
60
|
+
}
|
|
61
|
+
.hero--vertical-center {
|
|
62
|
+
align-items: center;
|
|
63
|
+
}
|
|
64
|
+
.hero--vertical-bottom {
|
|
65
|
+
align-items: flex-end;
|
|
66
|
+
}
|
|
67
|
+
.hero__title {
|
|
68
|
+
font-size: var(--font-size-8xl);
|
|
69
|
+
font-weight: var(--font-weight-bold);
|
|
70
|
+
line-height: 1.2;
|
|
71
|
+
color: var(--color-foreground-1);
|
|
72
|
+
margin: 0;
|
|
73
|
+
letter-spacing: -.04em;
|
|
74
|
+
text-shadow: 0 6px 0 var(--color-accent);
|
|
75
|
+
}
|
|
76
|
+
.hero__subtitle {
|
|
77
|
+
font-size: var(--font-size-xl);
|
|
78
|
+
font-weight: var(--font-weight-normal);
|
|
79
|
+
line-height: 1.5;
|
|
80
|
+
background-color: var(--color-bg-2);
|
|
81
|
+
padding: .2em .6em;
|
|
82
|
+
color: var(--color-foreground-2);
|
|
83
|
+
margin: 0;
|
|
84
|
+
max-width: 60ch;
|
|
85
|
+
}
|
|
86
|
+
.hero--parallax .hero__background {
|
|
87
|
+
will-change: transform;
|
|
88
|
+
transform-style: preserve-3d;
|
|
89
|
+
}
|
|
90
|
+
.hero__background-image-author {
|
|
91
|
+
position: absolute;
|
|
92
|
+
bottom: var(--spacing-2);
|
|
93
|
+
right: var(--spacing-2);
|
|
94
|
+
font-size: var(--font-size-sm);
|
|
95
|
+
color: var(--color-foreground-4);
|
|
96
|
+
background-color: var(--color-bg-2);
|
|
97
|
+
padding: var(--spacing-1) var(--spacing-2);
|
|
98
|
+
z-index: 3;
|
|
99
|
+
}
|
|
100
|
+
@media (max-width: 768px) {
|
|
101
|
+
.hero__title {
|
|
102
|
+
font-size: calc(var(--font-size-3xl));
|
|
103
|
+
}
|
|
104
|
+
.hero__subtitle {
|
|
105
|
+
font-size: var(--font-size-lg);
|
|
106
|
+
}
|
|
107
|
+
.hero__content {
|
|
108
|
+
padding: var(--spacing-6) var(--spacing-4);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
@media (max-width: 480px) {
|
|
112
|
+
.hero__title {
|
|
113
|
+
font-size: calc(var(--font-size-2xl));
|
|
114
|
+
}
|
|
115
|
+
.hero__subtitle {
|
|
116
|
+
font-size: var(--font-size-md);
|
|
117
|
+
}
|
|
118
|
+
.hero__content {
|
|
119
|
+
padding: var(--spacing-4) var(--spacing-3);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
interface HeroProps {
|
|
4
|
+
/**
|
|
5
|
+
* Hero title
|
|
6
|
+
*/
|
|
7
|
+
title: React__default.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Hero subtitle
|
|
10
|
+
*/
|
|
11
|
+
subtitle?: React__default.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Button or action element
|
|
14
|
+
*/
|
|
15
|
+
action?: React__default.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Background color
|
|
18
|
+
*/
|
|
19
|
+
backgroundColor?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Background image URL
|
|
22
|
+
*/
|
|
23
|
+
backgroundImage?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Background image position
|
|
26
|
+
* @default 'center'
|
|
27
|
+
*/
|
|
28
|
+
backgroundPosition?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Background image size
|
|
31
|
+
* @default 'cover'
|
|
32
|
+
*/
|
|
33
|
+
backgroundSize?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Background image Y offset (starting position before parallax)
|
|
36
|
+
* Defines which Y point of the image aligns with Y=0 of the container
|
|
37
|
+
* @default 0
|
|
38
|
+
* @example '50%' centers the image vertically
|
|
39
|
+
* @example '-100px' moves image up by 100px
|
|
40
|
+
*/
|
|
41
|
+
backgroundYOffset?: string | number;
|
|
42
|
+
/**
|
|
43
|
+
* Hero height
|
|
44
|
+
* @default '50vh'
|
|
45
|
+
*/
|
|
46
|
+
height?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Custom padding
|
|
49
|
+
*/
|
|
50
|
+
padding?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Content alignment
|
|
53
|
+
* @default 'center'
|
|
54
|
+
*/
|
|
55
|
+
align?: 'left' | 'center' | 'right';
|
|
56
|
+
/**
|
|
57
|
+
* Vertical alignment
|
|
58
|
+
* @default 'center'
|
|
59
|
+
*/
|
|
60
|
+
verticalAlign?: 'top' | 'center' | 'bottom';
|
|
61
|
+
/**
|
|
62
|
+
* Fixed text color (overrides theme colors for better contrast with background images)
|
|
63
|
+
*/
|
|
64
|
+
titleColor?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Fixed subtitle color (overrides theme colors for better contrast with background images)
|
|
67
|
+
*/
|
|
68
|
+
subtitleColor?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Additional CSS class
|
|
71
|
+
*/
|
|
72
|
+
className?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Additional inline styles
|
|
75
|
+
*/
|
|
76
|
+
style?: React__default.CSSProperties;
|
|
77
|
+
/**
|
|
78
|
+
* Children content (overrides title/subtitle/action if provided)
|
|
79
|
+
*/
|
|
80
|
+
children?: React__default.ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* Enable parallax vertical effect on scroll
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
parallax?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Parallax movement speed/amount
|
|
88
|
+
* @default 0.5
|
|
89
|
+
* @example 0.3 - slow movement (30% of scroll)
|
|
90
|
+
* @example 1 - match scroll speed
|
|
91
|
+
* @example '50%' - move 50% of scroll distance
|
|
92
|
+
* @example '200px' - move maximum 200px
|
|
93
|
+
*/
|
|
94
|
+
parallaxSpeed?: number | string;
|
|
95
|
+
/**
|
|
96
|
+
* Apply blur effect to background image
|
|
97
|
+
* @default false
|
|
98
|
+
*/
|
|
99
|
+
blur?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Background image author name (shown when backgroundImage is provided)
|
|
102
|
+
*/
|
|
103
|
+
backgroundAuthor?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Background image author link (optional, makes author name clickable)
|
|
106
|
+
*/
|
|
107
|
+
backgroundAuthorLink?: string;
|
|
108
|
+
}
|
|
109
|
+
declare const Hero: React__default.ForwardRefExoticComponent<HeroProps & React__default.RefAttributes<HTMLElement>>;
|
|
110
|
+
|
|
111
|
+
export { Hero, type HeroProps };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
interface HeroProps {
|
|
4
|
+
/**
|
|
5
|
+
* Hero title
|
|
6
|
+
*/
|
|
7
|
+
title: React__default.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Hero subtitle
|
|
10
|
+
*/
|
|
11
|
+
subtitle?: React__default.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Button or action element
|
|
14
|
+
*/
|
|
15
|
+
action?: React__default.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Background color
|
|
18
|
+
*/
|
|
19
|
+
backgroundColor?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Background image URL
|
|
22
|
+
*/
|
|
23
|
+
backgroundImage?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Background image position
|
|
26
|
+
* @default 'center'
|
|
27
|
+
*/
|
|
28
|
+
backgroundPosition?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Background image size
|
|
31
|
+
* @default 'cover'
|
|
32
|
+
*/
|
|
33
|
+
backgroundSize?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Background image Y offset (starting position before parallax)
|
|
36
|
+
* Defines which Y point of the image aligns with Y=0 of the container
|
|
37
|
+
* @default 0
|
|
38
|
+
* @example '50%' centers the image vertically
|
|
39
|
+
* @example '-100px' moves image up by 100px
|
|
40
|
+
*/
|
|
41
|
+
backgroundYOffset?: string | number;
|
|
42
|
+
/**
|
|
43
|
+
* Hero height
|
|
44
|
+
* @default '50vh'
|
|
45
|
+
*/
|
|
46
|
+
height?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Custom padding
|
|
49
|
+
*/
|
|
50
|
+
padding?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Content alignment
|
|
53
|
+
* @default 'center'
|
|
54
|
+
*/
|
|
55
|
+
align?: 'left' | 'center' | 'right';
|
|
56
|
+
/**
|
|
57
|
+
* Vertical alignment
|
|
58
|
+
* @default 'center'
|
|
59
|
+
*/
|
|
60
|
+
verticalAlign?: 'top' | 'center' | 'bottom';
|
|
61
|
+
/**
|
|
62
|
+
* Fixed text color (overrides theme colors for better contrast with background images)
|
|
63
|
+
*/
|
|
64
|
+
titleColor?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Fixed subtitle color (overrides theme colors for better contrast with background images)
|
|
67
|
+
*/
|
|
68
|
+
subtitleColor?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Additional CSS class
|
|
71
|
+
*/
|
|
72
|
+
className?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Additional inline styles
|
|
75
|
+
*/
|
|
76
|
+
style?: React__default.CSSProperties;
|
|
77
|
+
/**
|
|
78
|
+
* Children content (overrides title/subtitle/action if provided)
|
|
79
|
+
*/
|
|
80
|
+
children?: React__default.ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* Enable parallax vertical effect on scroll
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
parallax?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Parallax movement speed/amount
|
|
88
|
+
* @default 0.5
|
|
89
|
+
* @example 0.3 - slow movement (30% of scroll)
|
|
90
|
+
* @example 1 - match scroll speed
|
|
91
|
+
* @example '50%' - move 50% of scroll distance
|
|
92
|
+
* @example '200px' - move maximum 200px
|
|
93
|
+
*/
|
|
94
|
+
parallaxSpeed?: number | string;
|
|
95
|
+
/**
|
|
96
|
+
* Apply blur effect to background image
|
|
97
|
+
* @default false
|
|
98
|
+
*/
|
|
99
|
+
blur?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Background image author name (shown when backgroundImage is provided)
|
|
102
|
+
*/
|
|
103
|
+
backgroundAuthor?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Background image author link (optional, makes author name clickable)
|
|
106
|
+
*/
|
|
107
|
+
backgroundAuthorLink?: string;
|
|
108
|
+
}
|
|
109
|
+
declare const Hero: React__default.ForwardRefExoticComponent<HeroProps & React__default.RefAttributes<HTMLElement>>;
|
|
110
|
+
|
|
111
|
+
export { Hero, type HeroProps };
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
// src/components/hero/index.ts
|
|
31
|
+
var hero_exports = {};
|
|
32
|
+
__export(hero_exports, {
|
|
33
|
+
Hero: () => Hero
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(hero_exports);
|
|
36
|
+
|
|
37
|
+
// src/components/hero/Hero.tsx
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
var useParallax = (enabled, backgroundImage, backgroundSize, _backgroundPosition, parallaxSpeed = 0.5) => {
|
|
41
|
+
const [offsetY, setOffsetY] = (0, import_react.useState)(0);
|
|
42
|
+
const [imageDimensions, setImageDimensions] = (0, import_react.useState)(null);
|
|
43
|
+
const elementRef = (0, import_react.useRef)(null);
|
|
44
|
+
const getHeroHeight = () => {
|
|
45
|
+
if (!elementRef.current) return 0;
|
|
46
|
+
const computedStyle = window.getComputedStyle(elementRef.current);
|
|
47
|
+
const heightValue = computedStyle.height;
|
|
48
|
+
if (heightValue.endsWith("px")) {
|
|
49
|
+
return parseFloat(heightValue);
|
|
50
|
+
} else if (heightValue.endsWith("vh")) {
|
|
51
|
+
return parseFloat(heightValue) / 100 * window.innerHeight;
|
|
52
|
+
} else if (heightValue.endsWith("rem")) {
|
|
53
|
+
return parseFloat(heightValue) * parseFloat(window.getComputedStyle(document.documentElement).fontSize);
|
|
54
|
+
}
|
|
55
|
+
return parseFloat(heightValue) || 400;
|
|
56
|
+
};
|
|
57
|
+
const getHeroWidth = () => {
|
|
58
|
+
if (!elementRef.current) return 0;
|
|
59
|
+
const computedStyle = window.getComputedStyle(elementRef.current);
|
|
60
|
+
const widthValue = computedStyle.width;
|
|
61
|
+
if (widthValue.endsWith("px")) {
|
|
62
|
+
return parseFloat(widthValue);
|
|
63
|
+
} else if (widthValue.endsWith("vw")) {
|
|
64
|
+
return parseFloat(widthValue) / 100 * window.innerWidth;
|
|
65
|
+
} else if (widthValue.endsWith("rem")) {
|
|
66
|
+
return parseFloat(widthValue) * parseFloat(window.getComputedStyle(document.documentElement).fontSize);
|
|
67
|
+
}
|
|
68
|
+
return parseFloat(widthValue) || 800;
|
|
69
|
+
};
|
|
70
|
+
const calculateEffectiveImageSize = (naturalWidth, naturalHeight, containerWidth, containerHeight, bgSize) => {
|
|
71
|
+
const aspectRatio = naturalWidth / naturalHeight;
|
|
72
|
+
const containerAspectRatio = containerWidth / containerHeight;
|
|
73
|
+
if (bgSize === "cover") {
|
|
74
|
+
if (aspectRatio > containerAspectRatio) {
|
|
75
|
+
return {
|
|
76
|
+
width: containerHeight * aspectRatio,
|
|
77
|
+
height: containerHeight
|
|
78
|
+
};
|
|
79
|
+
} else {
|
|
80
|
+
return {
|
|
81
|
+
width: containerWidth,
|
|
82
|
+
height: containerWidth / aspectRatio
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
} else if (bgSize === "contain") {
|
|
86
|
+
if (aspectRatio > containerAspectRatio) {
|
|
87
|
+
return {
|
|
88
|
+
width: containerWidth,
|
|
89
|
+
height: containerWidth / aspectRatio
|
|
90
|
+
};
|
|
91
|
+
} else {
|
|
92
|
+
return {
|
|
93
|
+
width: containerHeight * aspectRatio,
|
|
94
|
+
height: containerHeight
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
} else if (bgSize.includes("px")) {
|
|
98
|
+
const sizeParts = bgSize.split(" ");
|
|
99
|
+
if (sizeParts.length === 1) {
|
|
100
|
+
const size = parseFloat(sizeParts[0]);
|
|
101
|
+
return { width: size, height: size };
|
|
102
|
+
} else {
|
|
103
|
+
return {
|
|
104
|
+
width: parseFloat(sizeParts[0]),
|
|
105
|
+
height: parseFloat(sizeParts[1])
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
return { width: naturalWidth, height: naturalHeight };
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
(0, import_react.useEffect)(() => {
|
|
113
|
+
if (!enabled || !backgroundImage) return;
|
|
114
|
+
const img = new Image();
|
|
115
|
+
img.onload = () => {
|
|
116
|
+
setImageDimensions({
|
|
117
|
+
width: img.naturalWidth,
|
|
118
|
+
height: img.naturalHeight
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
img.src = backgroundImage;
|
|
122
|
+
}, [enabled, backgroundImage]);
|
|
123
|
+
(0, import_react.useEffect)(() => {
|
|
124
|
+
if (!enabled || !elementRef.current) return;
|
|
125
|
+
const getScrollParent = (element) => {
|
|
126
|
+
let currentElement = element.parentElement;
|
|
127
|
+
while (currentElement) {
|
|
128
|
+
const style = window.getComputedStyle(currentElement);
|
|
129
|
+
const hasScroll = style.overflowY === "auto" || style.overflowY === "scroll";
|
|
130
|
+
if (hasScroll) {
|
|
131
|
+
return currentElement;
|
|
132
|
+
}
|
|
133
|
+
currentElement = currentElement.parentElement;
|
|
134
|
+
}
|
|
135
|
+
return window.document.documentElement;
|
|
136
|
+
};
|
|
137
|
+
const scrollParent = getScrollParent(elementRef.current);
|
|
138
|
+
const isWindowScroll = scrollParent === document.documentElement;
|
|
139
|
+
const handleScroll = () => {
|
|
140
|
+
if (!elementRef.current) return;
|
|
141
|
+
const heroHeight = getHeroHeight();
|
|
142
|
+
const heroWidth = getHeroWidth();
|
|
143
|
+
let scrolled;
|
|
144
|
+
if (isWindowScroll) {
|
|
145
|
+
const rect = elementRef.current.getBoundingClientRect();
|
|
146
|
+
scrolled = Math.max(0, -rect.top);
|
|
147
|
+
} else {
|
|
148
|
+
const rect = elementRef.current.getBoundingClientRect();
|
|
149
|
+
const parentRect = scrollParent.getBoundingClientRect();
|
|
150
|
+
scrolled = Math.max(0, parentRect.top - rect.top);
|
|
151
|
+
}
|
|
152
|
+
let parallaxOffset;
|
|
153
|
+
if (typeof parallaxSpeed === "number") {
|
|
154
|
+
parallaxOffset = scrolled * -parallaxSpeed;
|
|
155
|
+
} else if (parallaxSpeed.includes("%")) {
|
|
156
|
+
const percent = parseFloat(parallaxSpeed) / 100;
|
|
157
|
+
parallaxOffset = scrolled * -percent;
|
|
158
|
+
} else {
|
|
159
|
+
const maxMovement = parseFloat(parallaxSpeed);
|
|
160
|
+
const ratio = Math.min(1, scrolled / heroHeight);
|
|
161
|
+
parallaxOffset = -maxMovement * ratio;
|
|
162
|
+
}
|
|
163
|
+
if (imageDimensions && backgroundSize) {
|
|
164
|
+
const effectiveSize = calculateEffectiveImageSize(
|
|
165
|
+
imageDimensions.width,
|
|
166
|
+
imageDimensions.height,
|
|
167
|
+
heroWidth,
|
|
168
|
+
heroHeight,
|
|
169
|
+
backgroundSize
|
|
170
|
+
);
|
|
171
|
+
const availableOffset = (effectiveSize.height - heroHeight) / 2;
|
|
172
|
+
if (availableOffset > 0) {
|
|
173
|
+
parallaxOffset = Math.max(-availableOffset, Math.min(availableOffset, parallaxOffset));
|
|
174
|
+
} else {
|
|
175
|
+
parallaxOffset = 0;
|
|
176
|
+
}
|
|
177
|
+
} else if (imageDimensions && imageDimensions.height <= heroHeight) {
|
|
178
|
+
parallaxOffset = 0;
|
|
179
|
+
}
|
|
180
|
+
setOffsetY(parallaxOffset);
|
|
181
|
+
};
|
|
182
|
+
scrollParent.addEventListener("scroll", handleScroll, { passive: true });
|
|
183
|
+
handleScroll();
|
|
184
|
+
return () => scrollParent.removeEventListener("scroll", handleScroll);
|
|
185
|
+
}, [enabled, imageDimensions, backgroundSize]);
|
|
186
|
+
return { offsetY, elementRef };
|
|
187
|
+
};
|
|
188
|
+
var Hero = import_react.default.forwardRef(
|
|
189
|
+
({
|
|
190
|
+
title,
|
|
191
|
+
subtitle,
|
|
192
|
+
action,
|
|
193
|
+
backgroundColor,
|
|
194
|
+
backgroundImage,
|
|
195
|
+
backgroundPosition = "center",
|
|
196
|
+
backgroundSize = "cover",
|
|
197
|
+
backgroundYOffset = 0,
|
|
198
|
+
height = "50vh",
|
|
199
|
+
padding,
|
|
200
|
+
align = "center",
|
|
201
|
+
verticalAlign = "center",
|
|
202
|
+
className,
|
|
203
|
+
style,
|
|
204
|
+
children,
|
|
205
|
+
parallax = false,
|
|
206
|
+
parallaxSpeed = 0.5,
|
|
207
|
+
titleColor,
|
|
208
|
+
subtitleColor,
|
|
209
|
+
blur = false,
|
|
210
|
+
backgroundAuthor,
|
|
211
|
+
backgroundAuthorLink,
|
|
212
|
+
...props
|
|
213
|
+
}, ref) => {
|
|
214
|
+
const { offsetY, elementRef } = useParallax(parallax, backgroundImage, backgroundSize, backgroundPosition, parallaxSpeed);
|
|
215
|
+
(0, import_react.useImperativeHandle)(ref, () => elementRef.current);
|
|
216
|
+
const titleStyle = titleColor ? { color: titleColor } : {};
|
|
217
|
+
const subtitleStyle = subtitleColor ? { color: subtitleColor } : {};
|
|
218
|
+
const heroClasses = [
|
|
219
|
+
"hero",
|
|
220
|
+
`hero--align-${align}`,
|
|
221
|
+
`hero--vertical-${verticalAlign}`,
|
|
222
|
+
parallax && "hero--parallax",
|
|
223
|
+
className
|
|
224
|
+
].filter(Boolean).join(" ");
|
|
225
|
+
const heroStyle = {
|
|
226
|
+
...style,
|
|
227
|
+
height,
|
|
228
|
+
backgroundColor,
|
|
229
|
+
padding
|
|
230
|
+
};
|
|
231
|
+
const getBackgroundPositionY = () => {
|
|
232
|
+
if (!parallax) return backgroundPosition;
|
|
233
|
+
let baseOffset = 0;
|
|
234
|
+
if (typeof backgroundYOffset === "number") {
|
|
235
|
+
baseOffset = backgroundYOffset;
|
|
236
|
+
} else if (typeof backgroundYOffset === "string") {
|
|
237
|
+
if (backgroundYOffset.includes("%")) {
|
|
238
|
+
return `center calc(${backgroundYOffset} + ${offsetY}px)`;
|
|
239
|
+
}
|
|
240
|
+
baseOffset = parseFloat(backgroundYOffset);
|
|
241
|
+
}
|
|
242
|
+
const finalY = baseOffset + offsetY;
|
|
243
|
+
return `center ${finalY}px`;
|
|
244
|
+
};
|
|
245
|
+
const backgroundStyle = backgroundImage ? {
|
|
246
|
+
backgroundImage: `url(${backgroundImage})`,
|
|
247
|
+
backgroundPosition: getBackgroundPositionY(),
|
|
248
|
+
backgroundSize,
|
|
249
|
+
filter: blur ? "blur(2px)" : void 0
|
|
250
|
+
} : {};
|
|
251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
252
|
+
"section",
|
|
253
|
+
{
|
|
254
|
+
ref: elementRef,
|
|
255
|
+
className: heroClasses,
|
|
256
|
+
style: heroStyle,
|
|
257
|
+
...props,
|
|
258
|
+
children: [
|
|
259
|
+
backgroundImage && backgroundAuthor && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "hero__background-image-author", children: [
|
|
260
|
+
"Image by ",
|
|
261
|
+
backgroundAuthorLink ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: backgroundAuthorLink, className: "link-action", target: "_blank", rel: "noopener noreferrer", children: backgroundAuthor }) : backgroundAuthor
|
|
262
|
+
] }),
|
|
263
|
+
backgroundImage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
className: "hero__background",
|
|
267
|
+
style: backgroundStyle
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "hero__overlay" }),
|
|
271
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "hero__content", children: children ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
272
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "hero__title", style: titleStyle, children: title }),
|
|
273
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "hero__subtitle", style: subtitleStyle, children: subtitle }),
|
|
274
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "hero__action", children: action })
|
|
275
|
+
] }) })
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
Hero.displayName = "Hero";
|
|
282
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
283
|
+
0 && (module.exports = {
|
|
284
|
+
Hero
|
|
285
|
+
});
|