@purestack/ts-components 1.1.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/LICENSE +21 -0
- package/README.md +10 -0
- package/dist/ts-components.d.mts +1662 -0
- package/dist/ts-components.d.mts.map +1 -0
- package/dist/ts-components.mjs +9200 -0
- package/dist/ts-components.mjs.map +1 -0
- package/package.json +130 -0
- package/src/defineComponents.ts +87 -0
- package/src/index.ts +270 -0
- package/src/registerStyles.ts +63 -0
- package/src/standard/alertBox/alertBox.ts +64 -0
- package/src/standard/autoId.ts +25 -0
- package/src/standard/badge/badge.ts +41 -0
- package/src/standard/badge/badgeStyle.ts +21 -0
- package/src/standard/barChart/barChart.ts +338 -0
- package/src/standard/barChart/barChartStyle.ts +81 -0
- package/src/standard/btn/btn.ts +191 -0
- package/src/standard/btn/btnStyle.ts +59 -0
- package/src/standard/btnGroup/btnGroup.ts +208 -0
- package/src/standard/btnGroup/btnGroupStyle.ts +85 -0
- package/src/standard/chart/cartesianChart.ts +99 -0
- package/src/standard/chart/chartDefaults.ts +25 -0
- package/src/standard/chart/chartUtils.ts +84 -0
- package/src/standard/classicLogo/classicLogo.ts +429 -0
- package/src/standard/classicLogo/classicLogoStyle.ts +292 -0
- package/src/standard/componentVariant.ts +153 -0
- package/src/standard/composer/composer.ts +1035 -0
- package/src/standard/composer/composerCanvasInitialStyle.ts +225 -0
- package/src/standard/composer/composerCanvasRevertStyle.ts +14 -0
- package/src/standard/composer/composerCanvasSharedStyle.ts +60 -0
- package/src/standard/composer/composerCanvasStyleTypes.ts +8 -0
- package/src/standard/composer/composerCanvasThemeStyle.ts +53 -0
- package/src/standard/composer/composerStyle.ts +156 -0
- package/src/standard/composer/emailHtmlPolicy.ts +474 -0
- package/src/standard/consent/consent.ts +173 -0
- package/src/standard/consent/consentStyle.ts +44 -0
- package/src/standard/contactForm/contactForm.ts +135 -0
- package/src/standard/contactForm/contactFormStyle.ts +116 -0
- package/src/standard/doughnutChart/doughnutChart.ts +527 -0
- package/src/standard/doughnutChart/doughnutChartStyle.ts +64 -0
- package/src/standard/dropFiles/dropFiles.ts +480 -0
- package/src/standard/dropFiles/dropFilesStyle.ts +171 -0
- package/src/standard/expandablePanel/expandablePanel.ts +106 -0
- package/src/standard/expandablePanel/expandablePanelStyle.ts +56 -0
- package/src/standard/flex/flex.ts +269 -0
- package/src/standard/flex/flexStyle.ts +556 -0
- package/src/standard/footer/footer.ts +93 -0
- package/src/standard/footer/footerStyle.ts +39 -0
- package/src/standard/form/autoCompleteInput.ts +567 -0
- package/src/standard/form/form.ts +205 -0
- package/src/standard/form/formCheck.ts +96 -0
- package/src/standard/form/formInputField.ts +184 -0
- package/src/standard/form/formSelectField.ts +152 -0
- package/src/standard/form/formStyle.ts +585 -0
- package/src/standard/form/multiAutoCompleteInput.ts +880 -0
- package/src/standard/grid/grid.ts +177 -0
- package/src/standard/grid/gridStyle.ts +56 -0
- package/src/standard/icon/icon.ts +96 -0
- package/src/standard/icon/iconStyle.ts +50 -0
- package/src/standard/landing/codeShowcase.ts +54 -0
- package/src/standard/landing/comparisonColumn.ts +30 -0
- package/src/standard/landing/comparisonFeature.ts +22 -0
- package/src/standard/landing/comparisonTable.ts +38 -0
- package/src/standard/landing/ctaSection.ts +59 -0
- package/src/standard/landing/featureCard.ts +41 -0
- package/src/standard/landing/landing.ts +52 -0
- package/src/standard/landing/landingBand.ts +217 -0
- package/src/standard/landing/landingSection.ts +43 -0
- package/src/standard/landing/landingTypes.ts +141 -0
- package/src/standard/landing/metricItem.ts +25 -0
- package/src/standard/landing/metricStrip.ts +20 -0
- package/src/standard/lineChart/lineChart.ts +462 -0
- package/src/standard/lineChart/lineChartStyle.ts +91 -0
- package/src/standard/logo/logo.ts +192 -0
- package/src/standard/logo/logoStyle.ts +164 -0
- package/src/standard/modal/modal.ts +171 -0
- package/src/standard/modal/modalStore.ts +154 -0
- package/src/standard/modal/modalStyle.ts +190 -0
- package/src/standard/navMenu/navMenu.ts +278 -0
- package/src/standard/navMenu/navMenuStyle.ts +323 -0
- package/src/standard/pageLinks/pageLinks.ts +90 -0
- package/src/standard/pageScript/pageScript.ts +155 -0
- package/src/standard/pageToc/pageToc.ts +154 -0
- package/src/standard/pageToc/pageTocStyle.ts +372 -0
- package/src/standard/panel/panel.ts +55 -0
- package/src/standard/panel/panelStyle.ts +15 -0
- package/src/standard/pricing/pricing.ts +146 -0
- package/src/standard/searchBox/searchBox.ts +54 -0
- package/src/standard/searchBox/searchBoxStyle.ts +180 -0
- package/src/standard/sectionHeader/sectionHeader.ts +99 -0
- package/src/standard/signIn/signIn.ts +167 -0
- package/src/standard/signIn/signInStyle.ts +70 -0
- package/src/standard/tabs/tabs.ts +193 -0
- package/src/standard/tabs/tabsStyle.ts +231 -0
- package/src/standard/themeToggle/themeToggle.ts +33 -0
- package/src/standard/themeToggle/themeToggleStyle.ts +88 -0
- package/src/standard/toast/toastHost.ts +42 -0
- package/src/standard/toast/toastStore.ts +50 -0
- package/src/standard/topBar/topBar.ts +101 -0
- package/src/standard/topBar/topBarStyle.ts +169 -0
- package/src/standard/virtualList/variableVirtualTable.ts +371 -0
- package/src/standard/virtualList/virtualList.ts +423 -0
- package/src/standard/virtualList/virtualListStyle.ts +34 -0
- package/src/standard/virtualList/virtualTable.ts +179 -0
- package/src/standard/virtualList/virtualTableStyle.ts +24 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { defineComponent, html } from 'regor'
|
|
2
|
+
|
|
3
|
+
export type ContactFormMethod = 'get' | 'post'
|
|
4
|
+
|
|
5
|
+
export interface ContactForm {
|
|
6
|
+
title?: string
|
|
7
|
+
description?: string
|
|
8
|
+
action?: string
|
|
9
|
+
method?: ContactFormMethod
|
|
10
|
+
submitLabel?: string
|
|
11
|
+
nameLabel?: string
|
|
12
|
+
emailLabel?: string
|
|
13
|
+
topicLabel?: string
|
|
14
|
+
messageLabel?: string
|
|
15
|
+
namePlaceholder?: string
|
|
16
|
+
emailPlaceholder?: string
|
|
17
|
+
messagePlaceholder?: string
|
|
18
|
+
topicGeneralLabel?: string
|
|
19
|
+
topicSupportLabel?: string
|
|
20
|
+
topicPartnershipLabel?: string
|
|
21
|
+
resolvedMethod?: ContactFormMethod
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const contactFormTemplate = html`<section class="contact-form">
|
|
25
|
+
<div class="contact-form__header">
|
|
26
|
+
<h3 class="contact-form__title">{{ title }}</h3>
|
|
27
|
+
<p class="contact-form__description">{{ description }}</p>
|
|
28
|
+
</div>
|
|
29
|
+
<form
|
|
30
|
+
class="contact-form__form"
|
|
31
|
+
:action="action"
|
|
32
|
+
:method="resolvedMethod"
|
|
33
|
+
enctype="text/plain"
|
|
34
|
+
>
|
|
35
|
+
<label class="contact-form__field">
|
|
36
|
+
<span class="contact-form__label">{{ nameLabel }}</span>
|
|
37
|
+
<input
|
|
38
|
+
class="contact-form__input"
|
|
39
|
+
type="text"
|
|
40
|
+
name="name"
|
|
41
|
+
:placeholder="namePlaceholder"
|
|
42
|
+
required
|
|
43
|
+
autocomplete="name"
|
|
44
|
+
/>
|
|
45
|
+
</label>
|
|
46
|
+
<label class="contact-form__field">
|
|
47
|
+
<span class="contact-form__label">{{ emailLabel }}</span>
|
|
48
|
+
<input
|
|
49
|
+
class="contact-form__input"
|
|
50
|
+
type="email"
|
|
51
|
+
name="email"
|
|
52
|
+
:placeholder="emailPlaceholder"
|
|
53
|
+
required
|
|
54
|
+
autocomplete="email"
|
|
55
|
+
/>
|
|
56
|
+
</label>
|
|
57
|
+
<label class="contact-form__field">
|
|
58
|
+
<span class="contact-form__label">{{ topicLabel }}</span>
|
|
59
|
+
<select class="contact-form__select" name="topic" required>
|
|
60
|
+
<option>{{ topicGeneralLabel }}</option>
|
|
61
|
+
<option>{{ topicSupportLabel }}</option>
|
|
62
|
+
<option>{{ topicPartnershipLabel }}</option>
|
|
63
|
+
</select>
|
|
64
|
+
</label>
|
|
65
|
+
<label class="contact-form__field">
|
|
66
|
+
<span class="contact-form__label">{{ messageLabel }}</span>
|
|
67
|
+
<textarea
|
|
68
|
+
class="contact-form__textarea"
|
|
69
|
+
name="message"
|
|
70
|
+
rows="6"
|
|
71
|
+
:placeholder="messagePlaceholder"
|
|
72
|
+
required
|
|
73
|
+
></textarea>
|
|
74
|
+
</label>
|
|
75
|
+
<div class="contact-form__actions">
|
|
76
|
+
<Btn type="submit">
|
|
77
|
+
{{ submitLabel }}
|
|
78
|
+
</Btn>
|
|
79
|
+
</div>
|
|
80
|
+
</form>
|
|
81
|
+
</section>`
|
|
82
|
+
|
|
83
|
+
function defineContactFormComponent() {
|
|
84
|
+
return defineComponent<ContactForm>(contactFormTemplate, {
|
|
85
|
+
props: [
|
|
86
|
+
'title',
|
|
87
|
+
'description',
|
|
88
|
+
'action',
|
|
89
|
+
'method',
|
|
90
|
+
'submitLabel',
|
|
91
|
+
'nameLabel',
|
|
92
|
+
'emailLabel',
|
|
93
|
+
'topicLabel',
|
|
94
|
+
'messageLabel',
|
|
95
|
+
'namePlaceholder',
|
|
96
|
+
'emailPlaceholder',
|
|
97
|
+
'messagePlaceholder',
|
|
98
|
+
'topicGeneralLabel',
|
|
99
|
+
'topicSupportLabel',
|
|
100
|
+
'topicPartnershipLabel',
|
|
101
|
+
],
|
|
102
|
+
context: (head) => resolveContactForm(head.props),
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function defineContactFormComponents() {
|
|
107
|
+
return {
|
|
108
|
+
contactForm: defineContactFormComponent(),
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function resolveContactForm(props: ContactForm): ContactForm {
|
|
113
|
+
const normalizedMethod = props.method?.trim().toLowerCase()
|
|
114
|
+
return {
|
|
115
|
+
title: props.title || 'Send a message',
|
|
116
|
+
description:
|
|
117
|
+
props.description ||
|
|
118
|
+
'Share context and goals so we can route your request quickly.',
|
|
119
|
+
action: props.action || 'mailto:team@purestack.dev',
|
|
120
|
+
method: props.method || 'post',
|
|
121
|
+
resolvedMethod: normalizedMethod === 'get' ? 'get' : 'post',
|
|
122
|
+
submitLabel: props.submitLabel || 'Send Message',
|
|
123
|
+
nameLabel: props.nameLabel || 'Name',
|
|
124
|
+
emailLabel: props.emailLabel || 'Email',
|
|
125
|
+
topicLabel: props.topicLabel || 'Topic',
|
|
126
|
+
messageLabel: props.messageLabel || 'Message',
|
|
127
|
+
namePlaceholder: props.namePlaceholder || 'Your name',
|
|
128
|
+
emailPlaceholder: props.emailPlaceholder || 'name@company.com',
|
|
129
|
+
messagePlaceholder:
|
|
130
|
+
props.messagePlaceholder || 'Tell us what you are trying to solve.',
|
|
131
|
+
topicGeneralLabel: props.topicGeneralLabel || 'General inquiry',
|
|
132
|
+
topicSupportLabel: props.topicSupportLabel || 'Technical support',
|
|
133
|
+
topicPartnershipLabel: props.topicPartnershipLabel || 'Partnership',
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { ThemePalette } from '@purestack/ts-style'
|
|
2
|
+
import {
|
|
3
|
+
BREAKPOINTS,
|
|
4
|
+
mediaMax,
|
|
5
|
+
styleBuilder,
|
|
6
|
+
type ThemeMode,
|
|
7
|
+
themes,
|
|
8
|
+
} from '@purestack/ts-style'
|
|
9
|
+
|
|
10
|
+
export function registerContactFormStyles() {
|
|
11
|
+
themes.forEach((theme, palette) => {
|
|
12
|
+
registerContactFormShellStyles(theme, palette)
|
|
13
|
+
registerContactFormFieldStyles(theme, palette)
|
|
14
|
+
registerContactFormActionStyles(theme)
|
|
15
|
+
registerContactFormResponsiveStyles(theme)
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function registerContactFormShellStyles(
|
|
20
|
+
theme: ThemeMode,
|
|
21
|
+
palette: ThemePalette,
|
|
22
|
+
) {
|
|
23
|
+
styleBuilder
|
|
24
|
+
.select('.contact-form', theme)
|
|
25
|
+
.margin('1.25rem 0 0')
|
|
26
|
+
.padding('1.125rem')
|
|
27
|
+
.display('grid')
|
|
28
|
+
.gap('0.875rem')
|
|
29
|
+
.borderRadius(palette.radii.lg)
|
|
30
|
+
.background(palette.current.surface.rest.background)
|
|
31
|
+
.border(`1px solid ${palette.current.border.default}`)
|
|
32
|
+
.boxShadow(palette.effect.panelShadow)
|
|
33
|
+
styleBuilder
|
|
34
|
+
.select('.contact-form__header', theme)
|
|
35
|
+
.display('grid')
|
|
36
|
+
.gap('0.375rem')
|
|
37
|
+
styleBuilder
|
|
38
|
+
.select('.contact-form__title', theme)
|
|
39
|
+
.margin('0')
|
|
40
|
+
.fontSize('1.05rem')
|
|
41
|
+
.fontWeight('760')
|
|
42
|
+
.letterSpacing('-0.01em')
|
|
43
|
+
.color(palette.current.text.default)
|
|
44
|
+
styleBuilder
|
|
45
|
+
.select('.contact-form__description', theme)
|
|
46
|
+
.margin('0')
|
|
47
|
+
.fontSize('0.93rem')
|
|
48
|
+
.lineHeight('1.6')
|
|
49
|
+
.color(palette.current.text.subtle)
|
|
50
|
+
styleBuilder
|
|
51
|
+
.select('.contact-form__form', theme)
|
|
52
|
+
.display('grid')
|
|
53
|
+
.gap('0.625rem')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function registerContactFormFieldStyles(
|
|
57
|
+
theme: ThemeMode,
|
|
58
|
+
palette: ThemePalette,
|
|
59
|
+
) {
|
|
60
|
+
styleBuilder
|
|
61
|
+
.select('.contact-form__field', theme)
|
|
62
|
+
.display('grid')
|
|
63
|
+
.gap('0.375rem')
|
|
64
|
+
styleBuilder
|
|
65
|
+
.select('.contact-form__label', theme)
|
|
66
|
+
.fontSize('0.86rem')
|
|
67
|
+
.fontWeight('700')
|
|
68
|
+
.color(palette.current.text.default)
|
|
69
|
+
styleBuilder
|
|
70
|
+
.select(
|
|
71
|
+
'.contact-form__input, .contact-form__select, .contact-form__textarea',
|
|
72
|
+
theme,
|
|
73
|
+
)
|
|
74
|
+
.width('100%')
|
|
75
|
+
.padding('0.625rem 0.75rem')
|
|
76
|
+
.borderRadius(palette.radii.md)
|
|
77
|
+
.border(`1px solid ${palette.current.border.default}`)
|
|
78
|
+
.background(palette.current.surfaceAlt.rest.background)
|
|
79
|
+
.color(palette.current.text.default)
|
|
80
|
+
.fontSize('0.92rem')
|
|
81
|
+
.lineHeight('1.45')
|
|
82
|
+
.boxSizing('border-box')
|
|
83
|
+
.appearance('none')
|
|
84
|
+
styleBuilder
|
|
85
|
+
.select('.contact-form__textarea', theme)
|
|
86
|
+
.resize('vertical')
|
|
87
|
+
.minHeight('8.25rem')
|
|
88
|
+
styleBuilder
|
|
89
|
+
.select(
|
|
90
|
+
'.contact-form__input::placeholder, .contact-form__textarea::placeholder',
|
|
91
|
+
theme,
|
|
92
|
+
)
|
|
93
|
+
.color(palette.current.text.subtle)
|
|
94
|
+
styleBuilder
|
|
95
|
+
.select(
|
|
96
|
+
'.contact-form__input:focus-visible, .contact-form__select:focus-visible, .contact-form__textarea:focus-visible',
|
|
97
|
+
theme,
|
|
98
|
+
)
|
|
99
|
+
.outline(`2px solid ${palette.current.border.focus}`)
|
|
100
|
+
.borderColor(palette.current.border.default)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function registerContactFormActionStyles(theme: ThemeMode) {
|
|
104
|
+
styleBuilder
|
|
105
|
+
.select('.contact-form__actions', theme)
|
|
106
|
+
.display('flex')
|
|
107
|
+
.justifyContent('flex-start')
|
|
108
|
+
.paddingTop('0.125rem')
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function registerContactFormResponsiveStyles(theme: ThemeMode) {
|
|
112
|
+
styleBuilder
|
|
113
|
+
.select('.contact-form', theme)
|
|
114
|
+
.media(mediaMax(BREAKPOINTS.sm))
|
|
115
|
+
.padding('0.875rem')
|
|
116
|
+
}
|