chrona-react 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.
@@ -0,0 +1,74 @@
1
+ import { P as PartProps, H as HiddenInputProps, C as ChronaConfig } from './form-BCAGbNh-.js';
2
+ import * as chrona_core from 'chrona-core';
3
+ import * as React from 'react';
4
+ import { F as FieldProps } from './field-CQjoX8QG.js';
5
+
6
+ type TimeFieldProps = FieldProps<"time">;
7
+ declare const TimeField: {
8
+ Root: ({ children, asChild, className, style, ...props }: FieldProps<"time"> & Pick<PartProps, "children" | "asChild" | "className" | "style">) => React.JSX.Element;
9
+ Label: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
10
+ asChild?: boolean;
11
+ } & React.RefAttributes<HTMLElement>>;
12
+ Field: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
13
+ asChild?: boolean;
14
+ } & React.RefAttributes<HTMLElement>>;
15
+ Segment: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "value" | "defaultValue" | "onChange" | "children" | "type"> & {
16
+ type: chrona_core.SegmentType;
17
+ } & React.RefAttributes<HTMLInputElement>>;
18
+ HiddenInput: (props: HiddenInputProps) => React.JSX.Element;
19
+ ClearButton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
20
+ asChild?: boolean;
21
+ } & React.RefAttributes<HTMLElement>>;
22
+ LiveRegion: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
23
+ asChild?: boolean;
24
+ } & React.RefAttributes<HTMLElement>>;
25
+ };
26
+ declare function useTimeField(props?: TimeFieldProps): {
27
+ id: string;
28
+ state: chrona_core.FieldState<"time">;
29
+ options: FieldProps<"time"> & ChronaConfig;
30
+ send: (event: chrona_core.FieldEvent) => void;
31
+ reset: () => void;
32
+ moveFocus: (segment: chrona_core.SegmentType, offset: number) => void;
33
+ groupRef: React.RefObject<HTMLElement | null>;
34
+ announcement: string;
35
+ registerLabel: React.Dispatch<React.SetStateAction<boolean>>;
36
+ api: {
37
+ segments: {
38
+ type: chrona_core.SegmentType | "literal";
39
+ value: string;
40
+ }[];
41
+ getGroupProps: () => {
42
+ role: "group";
43
+ "aria-labelledby": string | undefined;
44
+ "aria-describedby": string | undefined;
45
+ "aria-invalid": true | undefined;
46
+ "data-scope": string;
47
+ "data-part": string;
48
+ "data-invalid": string | undefined;
49
+ "data-disabled": string | undefined;
50
+ "data-readonly": string | undefined;
51
+ dir: "ltr" | "rtl" | undefined;
52
+ };
53
+ getSegmentProps: (segment: chrona_core.SegmentType) => {
54
+ role: "spinbutton";
55
+ "aria-label": string;
56
+ "aria-valuemin": number;
57
+ "aria-valuemax": number;
58
+ "aria-valuenow": number | undefined;
59
+ "aria-valuetext": string;
60
+ "aria-required": true | undefined;
61
+ "aria-invalid": true | undefined;
62
+ "aria-describedby": string | undefined;
63
+ "aria-readonly": true | undefined;
64
+ "data-scope": string;
65
+ "data-part": string;
66
+ "data-segment": chrona_core.SegmentName;
67
+ "data-placeholder": string | undefined;
68
+ "data-invalid": string | undefined;
69
+ display: string;
70
+ };
71
+ };
72
+ };
73
+
74
+ export { TimeField, type TimeFieldProps, useTimeField };
@@ -0,0 +1,11 @@
1
+ import {
2
+ TimeField,
3
+ useTimeField
4
+ } from "./chunk-6QRNDYNF.js";
5
+ import "./chunk-VSD2IX3U.js";
6
+ import "./chunk-GN2YCKFZ.js";
7
+ export {
8
+ TimeField,
9
+ useTimeField
10
+ };
11
+ //# sourceMappingURL=time-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "chrona-react",
3
+ "version": "0.1.0",
4
+ "description": "Headless Temporal-native React date and time primitives",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Devlin Duldulao",
8
+ "homepage": "https://github.com/devlinduldulao/chrona#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/devlinduldulao/chrona.git",
12
+ "directory": "packages/react"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/devlinduldulao/chrona/issues"
16
+ },
17
+ "keywords": [
18
+ "temporal",
19
+ "date",
20
+ "time",
21
+ "headless",
22
+ "react",
23
+ "calendar",
24
+ "datepicker",
25
+ "daterangepicker",
26
+ "timepicker",
27
+ "i18n",
28
+ "accessibility",
29
+ "aria"
30
+ ],
31
+ "sideEffects": false,
32
+ "files": [
33
+ "dist",
34
+ "LICENSE"
35
+ ],
36
+ "exports": {
37
+ ".": {
38
+ "types": "./dist/index.d.ts",
39
+ "import": "./dist/index.js"
40
+ },
41
+ "./calendar": {
42
+ "types": "./dist/calendar.d.ts",
43
+ "import": "./dist/calendar.js"
44
+ },
45
+ "./date-field": {
46
+ "types": "./dist/date-field.d.ts",
47
+ "import": "./dist/date-field.js"
48
+ },
49
+ "./time-field": {
50
+ "types": "./dist/time-field.d.ts",
51
+ "import": "./dist/time-field.js"
52
+ },
53
+ "./date-picker": {
54
+ "types": "./dist/date-picker.d.ts",
55
+ "import": "./dist/date-picker.js"
56
+ },
57
+ "./range-calendar": {
58
+ "types": "./dist/range-calendar.d.ts",
59
+ "import": "./dist/range-calendar.js"
60
+ }
61
+ },
62
+ "dependencies": {
63
+ "chrona-core": "^0.1.0"
64
+ },
65
+ "peerDependencies": {
66
+ "react": ">=18.0.0",
67
+ "react-dom": ">=18.0.0"
68
+ },
69
+ "publishConfig": {
70
+ "access": "public"
71
+ },
72
+ "scripts": {
73
+ "build": "tsup src/index.ts src/calendar.tsx src/date-field.tsx src/time-field.tsx src/date-picker.tsx src/range-calendar.tsx --format esm --dts --sourcemap --clean --target es2022 --external react --external react-dom"
74
+ }
75
+ }