@glueforms/react 0.0.0-stage → 0.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/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +54 -2
- package/THIRD-PARTY-NOTICES.txt +43 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +650 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +256 -0
- package/package.json +49 -4
- package/source/index.d.ts +17 -0
- package/source/index.jsx +557 -0
- package/source/shared/dates.js +225 -0
- package/source/shared/native.js +17 -0
- package/source/shared/ownership.js +50 -0
- package/source/shared/styles.css +256 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GlueForms contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @glueforms/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Version 0.1.0.
|
|
4
|
+
|
|
5
|
+
A declarative `DateField` for React 18.3 and 19. React is a peer dependency. No provider, submission hook or service connection is required.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { DateField } from '@glueforms/react';
|
|
9
|
+
import '@glueforms/react/styles.css';
|
|
10
|
+
|
|
11
|
+
export function Booking() {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<label htmlFor="visit">Visit date</label>
|
|
15
|
+
<DateField id="visit" name="visit" appearance="calendar" datePolicy="tomorrow" />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Use a separate label with htmlFor/id for the calendar appearance. Do not wrap the expanded calendar in a label. `appearance` defaults to `native`. `datePolicy` defaults to `any`. Standard input attributes and the forwarded ref apply to the native date input. Use a normal `<input type="time" step="60">` for time.
|
|
22
|
+
|
|
23
|
+
Use `defaultValue` for an uncontrolled input or `value` with `onValueChange` for a controlled input. Dates are local `YYYY-MM-DD` strings, never timestamps. Calendar actions propose a new value through `onValueChange(value, reason)`. Reasons are `input`, `selection`, `clear` and `constraint`. A controlled value remains unchanged until its owner updates it.
|
|
24
|
+
|
|
25
|
+
`onChange` receives native input changes. Calendar actions do not fabricate React events. Native typing calls both callbacks if supplied. Changing bounds can propose clearing an excluded controlled value once per consecutive value/bounds combination. If the owner retains it, the input stays invalid. Uncontrolled reset restores the default, then applies current limits.
|
|
26
|
+
|
|
27
|
+
Server rendering and initial hydration produce the native input without guessing the visitor's date. The calendar mounts on the client. StrictMode cleanup releases resources. The component owns its scope, so a document-wide core auto entry cannot also own that document.
|
|
28
|
+
|
|
29
|
+
Styles are explicit and use the same seven `--gf-calendar-*` theme variables as the core package. The library does not inject fonts, submit forms, check subscriptions or collect analytics.
|
|
30
|
+
|
|
31
|
+
MIT covers this package's original code. Lucide and inherited Feather notices are included. Readable sources and source maps are included. The GlueForms application is not included or relicensed.
|
|
32
|
+
|
|
33
|
+
## Install version 0.1.0
|
|
34
|
+
|
|
35
|
+
After version 0.1.0 is published and verified on npm, install the exact version:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
npm install @glueforms/react@0.1.0
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Until publication is verified, use the local archive produced by `npm pack`.
|
|
42
|
+
|
|
43
|
+
## Develop locally
|
|
44
|
+
|
|
45
|
+
Use Node.js 24 and npm for development. This is a build-tool requirement, not a browser or SSR runtime requirement. From this repository's root:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
npm ci
|
|
49
|
+
npm test
|
|
50
|
+
npm pack
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The test command builds the package first. The build produces `dist/` and readable `source/` files. They are generated locally and included in the npm archive. No installation or build command publishes a package.
|
|
54
|
+
|
|
55
|
+
Canonical sources are in `react/src/` and `shared/`. Shared helpers are included in this repository, so building does not require the GlueForms application or another checkout. The build keeps React external and never bundles it.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lucide Icons and Contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
The following Lucide icons are derived from the Feather project:
|
|
20
|
+
|
|
21
|
+
airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
|
|
22
|
+
|
|
23
|
+
The MIT License (MIT) (for the icons listed above)
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2013-present Cole Bemis
|
|
26
|
+
|
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
29
|
+
in the Software without restriction, including without limitation the rights
|
|
30
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
32
|
+
furnished to do so, subject to the following conditions:
|
|
33
|
+
|
|
34
|
+
The above copyright notice and this permission notice shall be included in all
|
|
35
|
+
copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
export type DatePolicy = "any" | "today" | "tomorrow";
|
|
3
|
+
export type ValueChangeReason = "input" | "selection" | "clear" | "constraint";
|
|
4
|
+
export type DateFieldProps = Omit<
|
|
5
|
+
React.InputHTMLAttributes<HTMLInputElement>,
|
|
6
|
+
"type" | "children" | "value" | "defaultValue" | "onChange"
|
|
7
|
+
> & {
|
|
8
|
+
appearance?: "native" | "calendar";
|
|
9
|
+
datePolicy?: DatePolicy;
|
|
10
|
+
value?: string;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
13
|
+
onValueChange?: (value: string, reason: ValueChangeReason) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const DateField: React.ForwardRefExoticComponent<
|
|
16
|
+
DateFieldProps & React.RefAttributes<HTMLInputElement>
|
|
17
|
+
>;
|