@glueforms/react 0.1.0 → 0.2.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/CHANGELOG.md +8 -2
- package/README.md +84 -28
- package/dist/form.css +495 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +19 -5
- package/source/shared/form.css +495 -0
- package/source/shared/ownership.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.2.0
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- Add optional `form.css` with complete form and calendar styles.
|
|
6
|
+
- Add CSS variables for typography, colors, borders and spacing.
|
|
7
|
+
- Preserve the calendar-only `styles.css` entry.
|
|
8
|
+
|
|
9
|
+
## 0.1.0
|
|
10
|
+
|
|
11
|
+
Initial release with civil date limits, accessible calendar selection and explicit styles.
|
package/README.md
CHANGED
|
@@ -1,55 +1,111 @@
|
|
|
1
1
|
# @glueforms/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Open-source library for building and styling React forms. Compose native inputs, labels, selects, textareas and submit buttons with `form.css`, and use `DateField` when you need a date picker or expanded calendar. Customize colors, fonts, borders and spacing with CSS variables.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Pair it with [GlueForms](https://glueforms.com/form-api), the form backend for collecting submissions by email and in an inbox.
|
|
6
|
+
|
|
7
|
+
Use it for contact forms, quote requests, feedback and appointment requests in React applications. React 18.3 and 19 are supported. The library keeps ordinary HTML form submission and works with server rendering.
|
|
8
|
+
|
|
9
|
+
[Form backend](https://glueforms.com) · [Form API](https://glueforms.com/form-api) · [Connection guide](https://glueforms.com/docs/connect) · [React form templates](https://glueforms.com/templates/react)
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
Install version 0.2.0 in your React app:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install @glueforms/react@0.2.0
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Replace `YOUR_FORM_URL` with your receiving endpoint:
|
|
6
20
|
|
|
7
21
|
```tsx
|
|
8
22
|
import { DateField } from '@glueforms/react';
|
|
9
|
-
import '@glueforms/react/
|
|
23
|
+
import '@glueforms/react/form.css';
|
|
10
24
|
|
|
11
|
-
export function
|
|
25
|
+
export function VisitForm() {
|
|
12
26
|
return (
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
27
|
+
<form className="gf-form" action="YOUR_FORM_URL" method="POST">
|
|
28
|
+
<h1>Request a visit</h1>
|
|
29
|
+
<div className="gf-field">
|
|
30
|
+
<label htmlFor="email">Your email</label>
|
|
31
|
+
<input id="email" name="replyto" type="email" required />
|
|
32
|
+
</div>
|
|
33
|
+
<div className="gf-field">
|
|
34
|
+
<label htmlFor="date">Preferred date</label>
|
|
35
|
+
<DateField id="date" name="date" appearance="calendar"
|
|
36
|
+
datePolicy="tomorrow" required />
|
|
37
|
+
</div>
|
|
38
|
+
<div className="gf-field">
|
|
39
|
+
<label htmlFor="time">Preferred time</label>
|
|
40
|
+
<input id="time" name="time" type="time" step="60" />
|
|
41
|
+
</div>
|
|
42
|
+
<button type="submit">Send request</button>
|
|
43
|
+
</form>
|
|
17
44
|
);
|
|
18
45
|
}
|
|
19
46
|
```
|
|
20
47
|
|
|
21
|
-
|
|
48
|
+
`appearance` defaults to `native`. `datePolicy` accepts `any`, `today` or `tomorrow`. Dates use the visitor's local day and submit as `YYYY-MM-DD`. Standard input attributes and the forwarded ref apply to the native date input. Keep the calendar's label separate with `htmlFor` and `id`.
|
|
49
|
+
|
|
50
|
+
## Customize the form
|
|
51
|
+
|
|
52
|
+
Add variables to your site's stylesheet. Use `:root` for all forms or `.gf-form` for one form:
|
|
53
|
+
|
|
54
|
+
```css
|
|
55
|
+
.gf-form {
|
|
56
|
+
--gf-font-family: Georgia, serif;
|
|
57
|
+
--gf-font-size: 16px;
|
|
58
|
+
--gf-text: #172033;
|
|
59
|
+
--gf-background: #fff;
|
|
60
|
+
--gf-primary: #1649b8;
|
|
61
|
+
--gf-primary-text: #fff;
|
|
62
|
+
--gf-border: #b7c1d3;
|
|
63
|
+
--gf-radius: 12px;
|
|
64
|
+
--gf-gap: 24px;
|
|
65
|
+
--gf-padding: 24px;
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`form.css` includes calendar styles. Choose `styles.css` instead if you only want the calendar styled. Neither stylesheet resets the page body or changes unrelated forms.
|
|
22
70
|
|
|
23
|
-
|
|
71
|
+
## Receive submissions with GlueForms
|
|
24
72
|
|
|
25
|
-
|
|
73
|
+
[GlueForms](https://glueforms.com) is a form backend for HTML forms, React apps and static websites. It receives submissions, sends email notifications and keeps messages in an inbox, so you can collect responses without building your own backend.
|
|
26
74
|
|
|
27
|
-
|
|
75
|
+
Use the [form API](https://glueforms.com/form-api) for contact forms, quote requests, feedback and other website forms. Keep your website and design, and send named fields to your form's submission URL with a normal POST request.
|
|
28
76
|
|
|
29
|
-
|
|
77
|
+
1. Create a [GlueForms account](https://glueforms.com) and verify your email.
|
|
78
|
+
2. Choose **Connect a form I already have** to set up a form, or select an existing one from **Forms**.
|
|
79
|
+
3. Copy its submission URL into `YOUR_FORM_URL` in the example. Send a test, then check **Messages**.
|
|
30
80
|
|
|
31
|
-
|
|
81
|
+
The [connection guide](https://glueforms.com/docs/connect) covers setup, email notifications and testing. The open-source library handles presentation in the browser. The hosted GlueForms service handles receiving and storing submissions. You can also use the library with your own form endpoint.
|
|
32
82
|
|
|
33
|
-
|
|
83
|
+
### Templates, integrations and AI tools
|
|
34
84
|
|
|
35
|
-
|
|
85
|
+
- Start with [HTML form templates](https://glueforms.com/templates) or [React form templates](https://glueforms.com/templates/react).
|
|
86
|
+
- Create [hosted forms](https://glueforms.com/hosted-forms) to collect responses through a shareable link without a website.
|
|
87
|
+
- Connect [integrations](https://glueforms.com/docs/integrations) such as Google Sheets, Slack, Notion and webhooks with Pro.
|
|
88
|
+
- Use the scoped [private API](https://glueforms.com/docs/private-api) or authorize an AI assistant through [MCP](https://glueforms.com/docs/mcp) with Pro to work with forms and messages.
|
|
89
|
+
- Browse the [AI-readable documentation index](https://glueforms.com/llms.txt) for product guides and integration references.
|
|
36
90
|
|
|
37
|
-
|
|
38
|
-
|
|
91
|
+
## Control the selected date
|
|
92
|
+
|
|
93
|
+
Use `defaultValue` for an uncontrolled input. Use `value` and `onValueChange` when React state owns the date:
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
const [date, setDate] = useState('');
|
|
97
|
+
<DateField aria-label="Visit date" appearance="calendar"
|
|
98
|
+
value={date} onValueChange={setDate} />
|
|
39
99
|
```
|
|
40
100
|
|
|
41
|
-
|
|
101
|
+
Import `useState` from React and place this code inside your component. The second callback argument is `input`, `selection`, `clear` or `constraint`. `onChange` handles native typing only. Calendar actions use `onValueChange`, and a controlled value waits for its owner to update it.
|
|
42
102
|
|
|
43
|
-
|
|
103
|
+
Server rendering produces a native input. Calendar enhancement starts after hydration. The component supports StrictMode cleanup and normal form reset. Do not mix it with the core package's document-wide auto initialization.
|
|
44
104
|
|
|
45
|
-
|
|
105
|
+
## Develop
|
|
46
106
|
|
|
47
|
-
|
|
48
|
-
npm ci
|
|
49
|
-
npm test
|
|
50
|
-
npm pack
|
|
51
|
-
```
|
|
107
|
+
Use Node.js 24 and npm. Run `npm ci`, `npm test` and `npm pack`. Tests build the package first. Sources are in `react/src/` and `shared/`. React is a peer dependency and is not bundled.
|
|
52
108
|
|
|
53
|
-
|
|
109
|
+
## License
|
|
54
110
|
|
|
55
|
-
|
|
111
|
+
The library is MIT licensed. This license applies to the package, not the hosted GlueForms service. See [LICENSE](LICENSE) and [third-party notices](THIRD-PARTY-NOTICES.txt) for Lucide and Feather icon attribution.
|
package/dist/form.css
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
/* Optional complete form presentation. Defaults remain inheritable via fallbacks. */
|
|
2
|
+
:where(.gf-form, .gf-form *) {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
}
|
|
5
|
+
:where(.gf-form) {
|
|
6
|
+
display: grid;
|
|
7
|
+
gap: var(--gf-gap, 20px);
|
|
8
|
+
width: 100%;
|
|
9
|
+
max-width: 560px;
|
|
10
|
+
margin: 0 auto;
|
|
11
|
+
padding: var(--gf-padding, 32px);
|
|
12
|
+
color: var(--gf-text, #111216);
|
|
13
|
+
background: var(--gf-background, #fff);
|
|
14
|
+
font-family: var(--gf-font-family, system-ui, sans-serif);
|
|
15
|
+
font-size: var(--gf-font-size, 14px);
|
|
16
|
+
line-height: 1.5;
|
|
17
|
+
}
|
|
18
|
+
:where(.gf-form h1, .gf-form h2) {
|
|
19
|
+
margin: 0 0 8px;
|
|
20
|
+
font-size: 1.857142857em;
|
|
21
|
+
font-weight: 600;
|
|
22
|
+
letter-spacing: -0.04em;
|
|
23
|
+
line-height: 1.2;
|
|
24
|
+
}
|
|
25
|
+
:where(.gf-form h3, .gf-form h4, .gf-form p) {
|
|
26
|
+
margin: 0;
|
|
27
|
+
}
|
|
28
|
+
:where(.gf-form .gf-field) {
|
|
29
|
+
display: grid;
|
|
30
|
+
gap: 7px;
|
|
31
|
+
min-width: 0;
|
|
32
|
+
}
|
|
33
|
+
:where(.gf-form label, .gf-form legend) {
|
|
34
|
+
display: block;
|
|
35
|
+
font-weight: 500;
|
|
36
|
+
}
|
|
37
|
+
:where(.gf-form input, .gf-form textarea, .gf-form select, .gf-form button) {
|
|
38
|
+
font: inherit;
|
|
39
|
+
}
|
|
40
|
+
:where(
|
|
41
|
+
.gf-form
|
|
42
|
+
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not(
|
|
43
|
+
[type="submit"]
|
|
44
|
+
):not([type="button"]):not([type="reset"]),
|
|
45
|
+
.gf-form textarea,
|
|
46
|
+
.gf-form select
|
|
47
|
+
) {
|
|
48
|
+
width: 100%;
|
|
49
|
+
min-width: 0;
|
|
50
|
+
border: 1px solid var(--gf-border, #d8d9e1);
|
|
51
|
+
border-radius: var(--gf-radius, 8px);
|
|
52
|
+
background: var(--gf-background, #fff);
|
|
53
|
+
color: var(--gf-text, #111216);
|
|
54
|
+
padding: 11px 12px;
|
|
55
|
+
}
|
|
56
|
+
:where(.gf-form textarea) {
|
|
57
|
+
min-height: 112px;
|
|
58
|
+
resize: vertical;
|
|
59
|
+
}
|
|
60
|
+
:where(.gf-form input[type="checkbox"], .gf-form input[type="radio"]) {
|
|
61
|
+
width: auto;
|
|
62
|
+
margin-right: 8px;
|
|
63
|
+
accent-color: var(--gf-primary, #2541e8);
|
|
64
|
+
}
|
|
65
|
+
:where(
|
|
66
|
+
.gf-form button[type="submit"],
|
|
67
|
+
.gf-form button:not([type]),
|
|
68
|
+
.gf-form input[type="submit"]
|
|
69
|
+
) {
|
|
70
|
+
border: 0;
|
|
71
|
+
border-radius: var(--gf-radius, 8px);
|
|
72
|
+
padding: 12px 18px;
|
|
73
|
+
background: var(--gf-primary, #2541e8);
|
|
74
|
+
color: var(--gf-primary-text, #fff);
|
|
75
|
+
font-weight: 500;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
}
|
|
78
|
+
:where(.gf-form fieldset) {
|
|
79
|
+
display: grid;
|
|
80
|
+
gap: 8px;
|
|
81
|
+
min-width: 0;
|
|
82
|
+
border: 0;
|
|
83
|
+
padding: 0;
|
|
84
|
+
margin: 0;
|
|
85
|
+
}
|
|
86
|
+
:where(.gf-form small) {
|
|
87
|
+
color: #6b6c77;
|
|
88
|
+
font-size: 0.857142857em;
|
|
89
|
+
}
|
|
90
|
+
:where(.gf-form :disabled) {
|
|
91
|
+
opacity: 0.6;
|
|
92
|
+
cursor: default;
|
|
93
|
+
}
|
|
94
|
+
:where(.gf-form :focus-visible) {
|
|
95
|
+
outline: 2px solid var(--gf-primary, #2541e8);
|
|
96
|
+
outline-offset: 3px;
|
|
97
|
+
}
|
|
98
|
+
:where(.gf-form .gf-choice-field) {
|
|
99
|
+
display: grid;
|
|
100
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
101
|
+
align-items: start;
|
|
102
|
+
gap: 8px;
|
|
103
|
+
}
|
|
104
|
+
:where(.gf-form .gf-choice-field > input) {
|
|
105
|
+
grid-column: 1;
|
|
106
|
+
grid-row: 1;
|
|
107
|
+
width: 16px;
|
|
108
|
+
height: 16px;
|
|
109
|
+
margin: 3px 0 0;
|
|
110
|
+
padding: 0;
|
|
111
|
+
}
|
|
112
|
+
:where(.gf-form .gf-choice-field > label) {
|
|
113
|
+
grid-column: 2;
|
|
114
|
+
grid-row: 1;
|
|
115
|
+
min-width: 0;
|
|
116
|
+
overflow-wrap: anywhere;
|
|
117
|
+
}
|
|
118
|
+
:where(.gf-form .gf-select-wrap) {
|
|
119
|
+
display: grid;
|
|
120
|
+
grid-template-columns: minmax(0, 1fr);
|
|
121
|
+
align-items: center;
|
|
122
|
+
min-width: 0;
|
|
123
|
+
}
|
|
124
|
+
:where(.gf-form .gf-select-wrap > select) {
|
|
125
|
+
grid-column: 1;
|
|
126
|
+
grid-row: 1;
|
|
127
|
+
appearance: none;
|
|
128
|
+
padding-right: 44px;
|
|
129
|
+
}
|
|
130
|
+
:where(.gf-form .gf-select-wrap > svg) {
|
|
131
|
+
grid-column: 1;
|
|
132
|
+
grid-row: 1;
|
|
133
|
+
justify-self: end;
|
|
134
|
+
width: 18px;
|
|
135
|
+
height: 18px;
|
|
136
|
+
margin-right: 16px;
|
|
137
|
+
pointer-events: none;
|
|
138
|
+
}
|
|
139
|
+
:where(.gf-form .gf-required-indicator) {
|
|
140
|
+
color: #6b6c77;
|
|
141
|
+
font-weight: 400;
|
|
142
|
+
margin-left: 3px;
|
|
143
|
+
}
|
|
144
|
+
:where(.gf-form .gf-react-choices) {
|
|
145
|
+
display: grid;
|
|
146
|
+
grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
|
|
147
|
+
gap: 10px;
|
|
148
|
+
}
|
|
149
|
+
:where(.gf-form .gf-react-choice) {
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
gap: 8px;
|
|
153
|
+
padding: 12px;
|
|
154
|
+
border: 1px solid var(--gf-border, #d8d9e1);
|
|
155
|
+
border-radius: var(--gf-radius, 8px);
|
|
156
|
+
cursor: pointer;
|
|
157
|
+
}
|
|
158
|
+
:where(.gf-form .gf-react-choice input) {
|
|
159
|
+
flex-shrink: 0;
|
|
160
|
+
margin: 0;
|
|
161
|
+
}
|
|
162
|
+
:where(.gf-form input[type="file"]) {
|
|
163
|
+
max-width: 100%;
|
|
164
|
+
}
|
|
165
|
+
:where(.gf-form altcha-widget) {
|
|
166
|
+
display: block;
|
|
167
|
+
min-width: 0;
|
|
168
|
+
}
|
|
169
|
+
@media (max-width: 480px) {
|
|
170
|
+
:where(.gf-form) {
|
|
171
|
+
padding: var(--gf-padding, 20px);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
.gf-calendar {
|
|
175
|
+
box-sizing: border-box;
|
|
176
|
+
min-width: 0;
|
|
177
|
+
width: 100%;
|
|
178
|
+
margin-top: 8px;
|
|
179
|
+
padding: 17px 19px 13px;
|
|
180
|
+
border: 1px solid var(--gf-calendar-border, #dfe3ed);
|
|
181
|
+
border-radius: var(--gf-calendar-radius, 11px);
|
|
182
|
+
background: var(--gf-calendar-background, #fff);
|
|
183
|
+
color: var(--gf-calendar-text, #343a4b);
|
|
184
|
+
font: inherit;
|
|
185
|
+
font-weight: 400;
|
|
186
|
+
line-height: 1.5;
|
|
187
|
+
}
|
|
188
|
+
.gf-calendar * {
|
|
189
|
+
box-sizing: border-box;
|
|
190
|
+
}
|
|
191
|
+
.gf-calendar-header {
|
|
192
|
+
display: flex;
|
|
193
|
+
align-items: center;
|
|
194
|
+
justify-content: space-between;
|
|
195
|
+
gap: 8px;
|
|
196
|
+
margin-bottom: 16px;
|
|
197
|
+
}
|
|
198
|
+
.gf-calendar-month {
|
|
199
|
+
font-size: 14px;
|
|
200
|
+
font-weight: 600;
|
|
201
|
+
text-align: center;
|
|
202
|
+
text-transform: capitalize;
|
|
203
|
+
letter-spacing: -0.025em;
|
|
204
|
+
}
|
|
205
|
+
.gf-calendar-nav {
|
|
206
|
+
display: flex;
|
|
207
|
+
gap: 3px;
|
|
208
|
+
flex-shrink: 0;
|
|
209
|
+
}
|
|
210
|
+
.gf-calendar .gf-calendar-nav-button {
|
|
211
|
+
display: flex;
|
|
212
|
+
align-items: center;
|
|
213
|
+
justify-content: center;
|
|
214
|
+
width: 29px;
|
|
215
|
+
height: 29px;
|
|
216
|
+
min-height: 0;
|
|
217
|
+
padding: 0;
|
|
218
|
+
border: 1px solid #e3e5ec;
|
|
219
|
+
border-radius: 6px;
|
|
220
|
+
background: var(--gf-calendar-background, #fff);
|
|
221
|
+
color: #5d6478;
|
|
222
|
+
cursor: pointer;
|
|
223
|
+
}
|
|
224
|
+
.gf-calendar-nav-button svg {
|
|
225
|
+
width: 15px;
|
|
226
|
+
height: 15px;
|
|
227
|
+
}
|
|
228
|
+
.gf-calendar .gf-calendar-nav-button:hover:not(:disabled) {
|
|
229
|
+
background: #f1f4ff;
|
|
230
|
+
color: var(--gf-calendar-accent, #2541e8);
|
|
231
|
+
border-color: #bac8ff;
|
|
232
|
+
}
|
|
233
|
+
.gf-calendar-grid,
|
|
234
|
+
.gf-calendar-days {
|
|
235
|
+
display: grid;
|
|
236
|
+
gap: 5px;
|
|
237
|
+
}
|
|
238
|
+
.gf-calendar-row {
|
|
239
|
+
display: grid;
|
|
240
|
+
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
241
|
+
gap: 5px;
|
|
242
|
+
}
|
|
243
|
+
.gf-calendar-weekday {
|
|
244
|
+
overflow: hidden;
|
|
245
|
+
text-overflow: clip;
|
|
246
|
+
text-align: center;
|
|
247
|
+
font-size: 11px;
|
|
248
|
+
font-weight: 500;
|
|
249
|
+
line-height: 26px;
|
|
250
|
+
color: var(--gf-calendar-muted, #686e7e);
|
|
251
|
+
}
|
|
252
|
+
.gf-calendar-cell {
|
|
253
|
+
display: flex;
|
|
254
|
+
justify-content: center;
|
|
255
|
+
min-width: 0;
|
|
256
|
+
}
|
|
257
|
+
.gf-calendar .gf-calendar-day {
|
|
258
|
+
position: relative;
|
|
259
|
+
width: 100%;
|
|
260
|
+
max-width: 42px;
|
|
261
|
+
min-height: 38px;
|
|
262
|
+
padding: 0;
|
|
263
|
+
border: 1px solid transparent;
|
|
264
|
+
border-radius: 7px;
|
|
265
|
+
background: var(--gf-calendar-background, #fff);
|
|
266
|
+
color: var(--gf-calendar-text, #343a4b);
|
|
267
|
+
font: inherit;
|
|
268
|
+
font-size: 13px;
|
|
269
|
+
font-weight: 450;
|
|
270
|
+
font-variant-numeric: tabular-nums;
|
|
271
|
+
cursor: pointer;
|
|
272
|
+
}
|
|
273
|
+
.gf-calendar .gf-calendar-day:hover:not(:disabled) {
|
|
274
|
+
background: #edf2ff;
|
|
275
|
+
border-color: #cdd8ff;
|
|
276
|
+
color: var(--gf-calendar-accent, #2541e8);
|
|
277
|
+
}
|
|
278
|
+
.gf-calendar .gf-calendar-day[data-outside="true"] {
|
|
279
|
+
color: #81899b;
|
|
280
|
+
}
|
|
281
|
+
.gf-calendar
|
|
282
|
+
.gf-calendar-day[aria-current="date"]:not([aria-pressed="true"]):after {
|
|
283
|
+
content: "";
|
|
284
|
+
position: absolute;
|
|
285
|
+
bottom: 3px;
|
|
286
|
+
left: calc(50% - 1.5px);
|
|
287
|
+
height: 3px;
|
|
288
|
+
width: 3px;
|
|
289
|
+
border-radius: 50%;
|
|
290
|
+
background: var(--gf-calendar-accent, #2541e8);
|
|
291
|
+
}
|
|
292
|
+
.gf-calendar .gf-calendar-day[aria-pressed="true"] {
|
|
293
|
+
background: var(--gf-calendar-accent, #2541e8);
|
|
294
|
+
border-color: var(--gf-calendar-accent, #2541e8);
|
|
295
|
+
color: var(--gf-calendar-accent-text, #fff);
|
|
296
|
+
font-weight: 600;
|
|
297
|
+
box-shadow: 0 2px 5px #2541e822;
|
|
298
|
+
}
|
|
299
|
+
.gf-calendar .gf-calendar-day:disabled,
|
|
300
|
+
.gf-calendar .gf-calendar-nav-button:disabled {
|
|
301
|
+
opacity: 1;
|
|
302
|
+
color: #b1b7c5;
|
|
303
|
+
background: #f8f9fb;
|
|
304
|
+
cursor: default;
|
|
305
|
+
}
|
|
306
|
+
.gf-calendar .gf-calendar-day:disabled {
|
|
307
|
+
background: transparent;
|
|
308
|
+
}
|
|
309
|
+
.gf-calendar .gf-calendar-day[aria-pressed="true"]:disabled {
|
|
310
|
+
background: #e8ebf3;
|
|
311
|
+
color: #697086;
|
|
312
|
+
border-color: #e8ebf3;
|
|
313
|
+
box-shadow: none;
|
|
314
|
+
}
|
|
315
|
+
.gf-calendar-footer {
|
|
316
|
+
display: flex;
|
|
317
|
+
align-items: center;
|
|
318
|
+
justify-content: space-between;
|
|
319
|
+
gap: 10px;
|
|
320
|
+
border-top: 1px solid #edf0f5;
|
|
321
|
+
padding-top: 12px;
|
|
322
|
+
margin-top: 12px;
|
|
323
|
+
}
|
|
324
|
+
.gf-calendar-policy {
|
|
325
|
+
color: var(--gf-calendar-muted, #686e7e);
|
|
326
|
+
font-size: 11px;
|
|
327
|
+
}
|
|
328
|
+
.gf-calendar .gf-calendar-clear {
|
|
329
|
+
min-height: 0;
|
|
330
|
+
padding: 3px;
|
|
331
|
+
border: 0;
|
|
332
|
+
border-radius: 4px;
|
|
333
|
+
background: none;
|
|
334
|
+
color: var(--gf-calendar-accent, #2541e8);
|
|
335
|
+
font: inherit;
|
|
336
|
+
font-size: 12px;
|
|
337
|
+
cursor: pointer;
|
|
338
|
+
}
|
|
339
|
+
.gf-calendar .gf-calendar-clear:disabled {
|
|
340
|
+
color: #9298a7;
|
|
341
|
+
cursor: default;
|
|
342
|
+
}
|
|
343
|
+
.gf-calendar-selection {
|
|
344
|
+
min-height: 35px;
|
|
345
|
+
margin: 11px 0 0;
|
|
346
|
+
padding: 9px 11px;
|
|
347
|
+
border-radius: 6px;
|
|
348
|
+
background: #f5f7fc;
|
|
349
|
+
color: #606a80;
|
|
350
|
+
font-size: 12px;
|
|
351
|
+
overflow-wrap: anywhere;
|
|
352
|
+
}
|
|
353
|
+
.gf-calendar-selection[data-selected="true"] {
|
|
354
|
+
background: #eef3ff;
|
|
355
|
+
color: var(--gf-calendar-accent, #2541e8);
|
|
356
|
+
}
|
|
357
|
+
.gf-calendar button:focus-visible {
|
|
358
|
+
outline: 2px solid var(--gf-calendar-accent, #2541e8);
|
|
359
|
+
outline-offset: 3px;
|
|
360
|
+
z-index: 1;
|
|
361
|
+
}
|
|
362
|
+
.gf-calendar-sr-only {
|
|
363
|
+
position: absolute;
|
|
364
|
+
width: 1px;
|
|
365
|
+
height: 1px;
|
|
366
|
+
padding: 0;
|
|
367
|
+
margin: -1px;
|
|
368
|
+
overflow: hidden;
|
|
369
|
+
clip: rect(0, 0, 0, 0);
|
|
370
|
+
white-space: nowrap;
|
|
371
|
+
border: 0;
|
|
372
|
+
}
|
|
373
|
+
@media (max-width: 420px) {
|
|
374
|
+
.gf-calendar {
|
|
375
|
+
padding: 14px 10px 12px;
|
|
376
|
+
}
|
|
377
|
+
.gf-calendar-row {
|
|
378
|
+
gap: 3px;
|
|
379
|
+
}
|
|
380
|
+
.gf-calendar-month {
|
|
381
|
+
font-size: 12px;
|
|
382
|
+
}
|
|
383
|
+
.gf-calendar-nav {
|
|
384
|
+
gap: 2px;
|
|
385
|
+
}
|
|
386
|
+
.gf-calendar .gf-calendar-nav-button {
|
|
387
|
+
width: 25px;
|
|
388
|
+
height: 28px;
|
|
389
|
+
}
|
|
390
|
+
.gf-calendar .gf-calendar-day {
|
|
391
|
+
min-height: 35px;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/* Keep the form primary color on the selected day, not every calendar button. */
|
|
396
|
+
.gf-primary-color .gf-calendar .gf-calendar-day:not([aria-pressed="true"]),
|
|
397
|
+
.gf-primary-color .gf-calendar .gf-calendar-nav-button,
|
|
398
|
+
.gf-primary-color .gf-calendar .gf-calendar-clear {
|
|
399
|
+
background-color: #ffffff !important;
|
|
400
|
+
border-color: #e3e5ec !important;
|
|
401
|
+
color: var(--gf-calendar-text, #343a4b) !important;
|
|
402
|
+
}
|
|
403
|
+
.gf-primary-color
|
|
404
|
+
.gf-calendar
|
|
405
|
+
.gf-calendar-day:not([aria-pressed="true"]):hover:not(:disabled),
|
|
406
|
+
.gf-primary-color .gf-calendar .gf-calendar-nav-button:hover:not(:disabled),
|
|
407
|
+
.gf-primary-color .gf-calendar .gf-calendar-clear:hover:not(:disabled) {
|
|
408
|
+
background-color: #f1f3f6 !important;
|
|
409
|
+
border-color: #697086 !important;
|
|
410
|
+
}
|
|
411
|
+
.gf-primary-color .gf-calendar .gf-calendar-day[aria-pressed="true"] {
|
|
412
|
+
box-shadow: none;
|
|
413
|
+
}
|
|
414
|
+
.gf-primary-color .gf-calendar .gf-calendar-day:disabled,
|
|
415
|
+
.gf-primary-color .gf-calendar .gf-calendar-nav-button:disabled,
|
|
416
|
+
.gf-primary-color .gf-calendar .gf-calendar-clear:disabled {
|
|
417
|
+
background-color: #f8f9fb !important;
|
|
418
|
+
border-color: #e3e5ec !important;
|
|
419
|
+
color: #9298a7 !important;
|
|
420
|
+
}
|
|
421
|
+
.gf-primary-color
|
|
422
|
+
.gf-calendar
|
|
423
|
+
.gf-calendar-day[aria-current="date"]:not([aria-pressed="true"]):after {
|
|
424
|
+
background: currentColor;
|
|
425
|
+
}
|
|
426
|
+
.gf-primary-color .gf-calendar .gf-calendar-selection[data-selected="true"] {
|
|
427
|
+
background: #f1f3f6;
|
|
428
|
+
color: var(--gf-calendar-text, #343a4b);
|
|
429
|
+
}
|
|
430
|
+
/* Form tokens are fallbacks, so inherited calendar-specific tokens keep priority. */
|
|
431
|
+
:where(.gf-form) .gf-calendar {
|
|
432
|
+
border-color: var(--gf-calendar-border, var(--gf-border, #dfe3ed));
|
|
433
|
+
border-radius: var(--gf-calendar-radius, var(--gf-radius, 11px));
|
|
434
|
+
background: var(--gf-calendar-background, var(--gf-background, #fff));
|
|
435
|
+
color: var(--gf-calendar-text, var(--gf-text, #343a4b));
|
|
436
|
+
}
|
|
437
|
+
:where(.gf-form) .gf-calendar .gf-calendar-day {
|
|
438
|
+
background: var(--gf-calendar-background, var(--gf-background, #fff));
|
|
439
|
+
color: var(--gf-calendar-text, var(--gf-text, #343a4b));
|
|
440
|
+
font-size: 0.928571429em;
|
|
441
|
+
}
|
|
442
|
+
:where(.gf-form) .gf-calendar .gf-calendar-day:hover:not(:disabled),
|
|
443
|
+
:where(.gf-form) .gf-calendar .gf-calendar-nav-button:hover:not(:disabled),
|
|
444
|
+
:where(.gf-form) .gf-calendar .gf-calendar-clear,
|
|
445
|
+
:where(.gf-form) .gf-calendar-selection[data-selected="true"] {
|
|
446
|
+
color: var(--gf-calendar-accent, var(--gf-primary, #2541e8));
|
|
447
|
+
}
|
|
448
|
+
:where(.gf-form)
|
|
449
|
+
.gf-calendar
|
|
450
|
+
.gf-calendar-day[aria-current="date"]:not([aria-pressed="true"]):after {
|
|
451
|
+
background: var(--gf-calendar-accent, var(--gf-primary, #2541e8));
|
|
452
|
+
}
|
|
453
|
+
:where(.gf-form) .gf-calendar .gf-calendar-day[aria-pressed="true"] {
|
|
454
|
+
background: var(--gf-calendar-accent, var(--gf-primary, #2541e8));
|
|
455
|
+
border-color: var(--gf-calendar-accent, var(--gf-primary, #2541e8));
|
|
456
|
+
color: var(--gf-calendar-accent-text, var(--gf-primary-text, #fff));
|
|
457
|
+
}
|
|
458
|
+
:where(.gf-form) .gf-calendar button:focus-visible {
|
|
459
|
+
outline-color: var(--gf-calendar-accent, var(--gf-primary, #2541e8));
|
|
460
|
+
}
|
|
461
|
+
:where(.gf-form) .gf-calendar-month {
|
|
462
|
+
font-size: 1em;
|
|
463
|
+
}
|
|
464
|
+
:where(.gf-form) .gf-calendar-weekday,
|
|
465
|
+
:where(.gf-form) .gf-calendar-policy {
|
|
466
|
+
font-size: 0.785714286em;
|
|
467
|
+
}
|
|
468
|
+
:where(.gf-form) .gf-calendar .gf-calendar-clear,
|
|
469
|
+
:where(.gf-form) .gf-calendar-selection {
|
|
470
|
+
font-size: 0.857142857em;
|
|
471
|
+
}
|
|
472
|
+
@media (max-width: 420px) {
|
|
473
|
+
:where(.gf-form) .gf-calendar-month {
|
|
474
|
+
font-size: 0.857142857em;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
:where(.gf-form) .gf-calendar .gf-calendar-day {
|
|
478
|
+
border-radius: var(--gf-radius, 7px);
|
|
479
|
+
}
|
|
480
|
+
:where(.gf-form) .gf-calendar .gf-calendar-nav-button {
|
|
481
|
+
border-radius: var(--gf-radius, 6px);
|
|
482
|
+
border-color: var(--gf-calendar-border, var(--gf-border, #e3e5ec));
|
|
483
|
+
background: var(--gf-calendar-background, var(--gf-background, #fff));
|
|
484
|
+
color: var(--gf-calendar-text, var(--gf-text, #5d6478));
|
|
485
|
+
}
|
|
486
|
+
:where(.gf-form) .gf-calendar .gf-calendar-clear {
|
|
487
|
+
border-radius: var(--gf-radius, 4px);
|
|
488
|
+
}
|
|
489
|
+
:where(.gf-form)
|
|
490
|
+
.gf-calendar
|
|
491
|
+
.gf-calendar-day[aria-pressed="true"]:hover:not(:disabled) {
|
|
492
|
+
background: var(--gf-calendar-accent, var(--gf-primary, #2541e8));
|
|
493
|
+
border-color: var(--gf-calendar-accent, var(--gf-primary, #2541e8));
|
|
494
|
+
color: var(--gf-calendar-accent-text, var(--gf-primary-text, #fff));
|
|
495
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -219,14 +219,14 @@ function nativeSelectable(probe, value, range, step, defaultValue) {
|
|
|
219
219
|
return !probe.validity.stepMismatch;
|
|
220
220
|
}
|
|
221
221
|
// shared/ownership.js
|
|
222
|
-
var VERSION = "0.
|
|
222
|
+
var VERSION = "0.2.0";
|
|
223
223
|
var registryKey = Symbol.for("glueforms.public.date-fields.ownership");
|
|
224
224
|
function acquire(root, kind, create) {
|
|
225
225
|
const document = root?.nodeType === 9 ? root : root?.ownerDocument;
|
|
226
226
|
const view = document?.defaultView;
|
|
227
227
|
if (!view || !(root instanceof view.Document || root instanceof view.Element)) throw new TypeError("GlueForms init requires a Document or Element root.");
|
|
228
228
|
let registry = document[registryKey];
|
|
229
|
-
if (registry && (registry.version !== "0.
|
|
229
|
+
if (registry && (registry.version !== "0.2.0" || !(registry.owners instanceof Map))) throw new Error("An incompatible GlueForms version already owns this document.");
|
|
230
230
|
if (registry) for (const [other, record] of registry.owners) {
|
|
231
231
|
if (root === other && record.kind === kind && kind === "core") return record.handle;
|
|
232
232
|
if (root === other || view.Node.prototype.contains.call(root, other) || view.Node.prototype.contains.call(other, root)) throw new Error("GlueForms roots overlap. Dispose the existing owner before initializing this root.");
|