@jamsrui/date-field 0.0.19

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 ADDED
@@ -0,0 +1,40 @@
1
+ # πŸš€ **JamsrUI**
2
+
3
+ **A comprehensive React UI component library designed for developers, with Tailwind CSS integration for seamless styling.**
4
+
5
+
6
+ ## πŸ“– **Overview**
7
+
8
+ [JamsrUI](https://jamsr-ui.jamsrworld.com) is designed to help developers build modern, fast and visually appealing web applications with ease.
9
+
10
+ ## πŸš€ Getting Started
11
+
12
+ Boost & Build your websites using [JamsrUI](https://jamsr-ui.jamsrworld.com).
13
+
14
+ ## ✨ Features
15
+
16
+ - πŸš€ **Production-Ready**: Optimized for modern React projects.
17
+ - 🎨 **Customizable**: Easily override styles and themes.
18
+ - πŸ› οΈ **Reusable Components**: Save time with prebuilt, efficient UI elements.
19
+ - ⚑ **Developer-Friendly**: Simple API and well-documented usage.
20
+ - πŸ“¦ **Lightweight**: Minimal dependencies for fast performance.
21
+ - πŸ–₯️ **Modern Design**: Clean, responsive, and user-friendly components.
22
+
23
+ ## 🌱 Community
24
+
25
+ We’re thrilled to see the community actively engage with **JamsrUI**! Whether you're sharing feedback, reporting bugs, requesting features, or showcasing projects built with JamsrUI, your involvement helps us grow and improve.
26
+
27
+ ### How to Engage
28
+
29
+ - πŸ’¬ **Report Bugs**: [GitHub Issues](https://github.com/jamsrworld/jamsr-ui/issues)
30
+ - πŸš€ **Request Features**: Share ideas for new components.
31
+ - 🀝 **Showcase Projects**: Let us know how you use JamsrUI.
32
+
33
+ ## Contributing
34
+
35
+ We welcome contributions from developers of all skill levels!
36
+
37
+ ## ⭐ Support the Project
38
+
39
+ If you find **JamsrUI** helpful, consider giving it a ⭐ on [GitHub](https://github.com/jamsrworld/jamsr-ui).
40
+
@@ -0,0 +1,21 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { WithGlobalConfig } from '@jamsrui/core';
3
+ import { DateField } from './date-field.mjs';
4
+ import './use-date-field.mjs';
5
+ import 'react';
6
+ import '@jamsrui/utils';
7
+ import './date-segment.mjs';
8
+ import './date-field-separator.mjs';
9
+ import './date-field-root.mjs';
10
+
11
+ declare const useDateFieldConfig: () => DateFieldConfig.Props;
12
+ declare const DateFieldConfig: (props: Omit<Partial<DateFieldConfig.Props>, "children"> & {
13
+ merge?: boolean;
14
+ children: React.ReactNode;
15
+ }) => react_jsx_runtime.JSX.Element;
16
+ declare namespace DateFieldConfig {
17
+ interface Props extends WithGlobalConfig<DateField.Props> {
18
+ }
19
+ }
20
+
21
+ export { DateFieldConfig, useDateFieldConfig };
@@ -0,0 +1 @@
1
+ "use client";import{createConfigContext as e}from"@jamsrui/utils";const[o,t]=e({displayName:"DateFieldConfig"});export{o as DateFieldConfig,t as useDateFieldConfig};
@@ -0,0 +1,15 @@
1
+ import * as react from 'react';
2
+ import { useDateField } from './use-date-field.mjs';
3
+ import '@jamsrui/utils';
4
+ import './date-segment.mjs';
5
+ import './date-field-separator.mjs';
6
+ import './date-field-root.mjs';
7
+
8
+ declare const useDateFieldContext: () => DateFieldContext.Props;
9
+ declare const DateFieldContext: react.Context<DateFieldContext.Props | null>;
10
+ declare namespace DateFieldContext {
11
+ interface Props extends ReturnType<typeof useDateField> {
12
+ }
13
+ }
14
+
15
+ export { DateFieldContext, useDateFieldContext };
@@ -0,0 +1 @@
1
+ "use client";import{createContext as t,use as o}from"react";const n=t(null),i=()=>{const e=o(n);if(!e)throw new Error("useDateFieldContext must be used within DateFieldContext");return e};export{n as DateFieldContext,i as useDateFieldContext};
@@ -0,0 +1,11 @@
1
+ import * as react from 'react';
2
+ import { UIProps } from '@jamsrui/utils';
3
+
4
+ declare const DateFieldRoot: (props: DateFieldRoot.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
5
+ declare namespace DateFieldRoot {
6
+ interface Props extends UIProps<"div"> {
7
+ as?: React.ElementType;
8
+ }
9
+ }
10
+
11
+ export { DateFieldRoot };
@@ -0,0 +1 @@
1
+ "use client";import{useRenderElement as p}from"@jamsrui/hooks";import{useDateFieldContext as a}from"./date-field-context.mjs";const R=e=>{const{as:t="div",children:o,className:r,...s}=e,{getRootProps:n}=a();return p(t,{props:n({...s,children:o,className:r})})};export{R as DateFieldRoot};
@@ -0,0 +1,10 @@
1
+ import * as react from 'react';
2
+ import { UIProps } from '@jamsrui/utils';
3
+
4
+ declare const DateFieldSeparator: (props: DateFieldSeparator.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
5
+ declare namespace DateFieldSeparator {
6
+ interface Props extends UIProps<"span"> {
7
+ }
8
+ }
9
+
10
+ export { DateFieldSeparator };
@@ -0,0 +1 @@
1
+ "use client";import{useRenderElement as t}from"@jamsrui/hooks";import{useDateFieldContext as o}from"./date-field-context.mjs";const s=e=>{const{getSeparatorProps:r}=o();return t("span",{props:[r(e),{children:"/"}]})};export{s as DateFieldSeparator};
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { useDateField } from './use-date-field.mjs';
3
+ import 'react';
4
+ import '@jamsrui/utils';
5
+ import './date-segment.mjs';
6
+ import './date-field-separator.mjs';
7
+ import './date-field-root.mjs';
8
+
9
+ declare const DateField: (props: DateField.Props) => react_jsx_runtime.JSX.Element;
10
+ declare namespace DateField {
11
+ interface Props extends useDateField.Props {
12
+ }
13
+ }
14
+
15
+ export { DateField };
@@ -0,0 +1 @@
1
+ "use client";import{jsx as o}from"react/jsx-runtime";import{mergeConfigProps as p}from"@jamsrui/utils";import{useDateFieldConfig as d}from"./date-field-config.mjs";import{DateFieldContext as l}from"./date-field-context.mjs";import{dateFieldVariants as m}from"./styles.mjs";import{useDateField as c}from"./use-date-field.mjs";const x=t=>{const r=d(),i=p(m.defaultVariants,r,t),e=c(i),{Component:n,getRootProps:s,children:a}=e;return o(l,{value:e,children:o(n,{...s({}),children:a})})};export{x as DateField};
@@ -0,0 +1,13 @@
1
+ import * as react from 'react';
2
+ import { UIProps } from '@jamsrui/utils';
3
+ import { DateSegment } from './date-segment.mjs';
4
+
5
+ declare const DateInput: (props: DateInput.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
6
+ declare namespace DateInput {
7
+ interface Props extends Omit<UIProps<"div">, "children"> {
8
+ as?: React.ElementType;
9
+ children?: React.ReactNode | ((segment: DateSegment.Segment) => React.ReactNode);
10
+ }
11
+ }
12
+
13
+ export { DateInput };
@@ -0,0 +1 @@
1
+ "use client";import{useRenderElement as m}from"@jamsrui/hooks";import{useDateFieldContext as a}from"./date-field-context.mjs";const g=t=>{const{as:n="div",children:e,...r}=t,{getInputProps:o,segmentList:p}=a();return m(n,{props:[o(r),{children:typeof e=="function"?p.map(s=>e(s)):e}]})};export{g as DateInput};
@@ -0,0 +1,12 @@
1
+ import * as react from 'react';
2
+ import { UIProps } from '@jamsrui/utils';
3
+
4
+ declare const DateSegment: (props: DateSegment.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
5
+ declare namespace DateSegment {
6
+ type Segment = "day" | "month" | "year";
7
+ interface Props extends UIProps<"div"> {
8
+ segment: Segment;
9
+ }
10
+ }
11
+
12
+ export { DateSegment };
@@ -0,0 +1 @@
1
+ "use client";import{useRenderElement as s}from"@jamsrui/hooks";import{useDateFieldContext as m}from"./date-field-context.mjs";import{useDateSegment as p}from"./use-date-segment.mjs";const c=e=>{const{segment:t,...r}=e,n=p({segment:t}),{getInputProps:o}=m();return s("div",{props:[o(r),{...n}]})};export{c as DateSegment};
@@ -0,0 +1,21 @@
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { DateField as DateField$1 } from './date-field.mjs';
4
+ export { DateFieldConfig, useDateFieldConfig } from './date-field-config.mjs';
5
+ import { DateFieldSeparator } from './date-field-separator.mjs';
6
+ import { DateInput } from './date-input.mjs';
7
+ import { DateSegment } from './date-segment.mjs';
8
+ export { DateFieldSlots, DateFieldVariants, dateFieldVariants } from './styles.mjs';
9
+ export { useDateField } from './use-date-field.mjs';
10
+ export { useDateSegment } from './use-date-segment.mjs';
11
+ import '@jamsrui/core';
12
+ import '@jamsrui/utils';
13
+ import './date-field-root.mjs';
14
+
15
+ declare const DateField: ((props: DateField$1.Props) => react_jsx_runtime.JSX.Element) & {
16
+ Input: (props: DateInput.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
17
+ Segment: (props: DateSegment.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
18
+ Separator: (props: DateFieldSeparator.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
19
+ };
20
+
21
+ export { DateField, DateField$1 as DateFieldRoot, DateFieldSeparator, DateInput, DateSegment };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{DateField as e}from"./date-field.mjs";import{DateFieldConfig as i,useDateFieldConfig as r}from"./date-field-config.mjs";import{DateFieldSeparator as t}from"./date-field-separator.mjs";import{DateInput as a}from"./date-input.mjs";import{DateSegment as o}from"./date-segment.mjs";import{dateFieldVariants as m}from"./styles.mjs";import{useDateField as p}from"./use-date-field.mjs";import{useDateSegment as l}from"./use-date-segment.mjs";const c=Object.assign(e,{Input:a,Segment:o,Separator:t});export{c as DateField,i as DateFieldConfig,e as DateFieldRoot,t as DateFieldSeparator,a as DateInput,o as DateSegment,m as dateFieldVariants,p as useDateField,r as useDateFieldConfig,l as useDateSegment};
@@ -0,0 +1,20 @@
1
+ import * as _jamsrui_utils from '@jamsrui/utils';
2
+ import { VariantProps } from '@jamsrui/utils';
3
+
4
+ declare const dateFieldVariants: _jamsrui_utils.TVReturnType<{}, {
5
+ root: string;
6
+ input: string;
7
+ separator: string;
8
+ }, undefined, {}, {
9
+ root: string;
10
+ input: string;
11
+ separator: string;
12
+ }, _jamsrui_utils.TVReturnType<{}, {
13
+ root: string;
14
+ input: string;
15
+ separator: string;
16
+ }, undefined, unknown, unknown, undefined>>;
17
+ type DateFieldVariants = VariantProps<typeof dateFieldVariants>;
18
+ type DateFieldSlots = keyof ReturnType<typeof dateFieldVariants>;
19
+
20
+ export { type DateFieldSlots, type DateFieldVariants, dateFieldVariants };
@@ -0,0 +1 @@
1
+ import{tv as t}from"@jamsrui/utils";const a=t({slots:{root:"flex gap-1 items-center",input:"focus:bg-default px-0.5 caret-transparent outline-none rounded text-sm",separator:"opacity-50"},variants:{},defaultVariants:{}});export{a as dateFieldVariants};
@@ -0,0 +1,25 @@
1
+ import * as react from 'react';
2
+ import { PropGetter } from '@jamsrui/utils';
3
+ import { DateSegment } from './date-segment.mjs';
4
+ import { DateFieldSeparator } from './date-field-separator.mjs';
5
+ import { DateFieldRoot } from './date-field-root.mjs';
6
+
7
+ type Segments = Record<DateSegment.Segment, string>;
8
+
9
+ declare const useDateField: (props: useDateField.Props) => {
10
+ Component: (props: DateFieldRoot.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
11
+ segments: Segments;
12
+ activeSegment: DateSegment.Segment;
13
+ getRootProps: PropGetter<DateFieldRoot.Props>;
14
+ getInputProps: PropGetter<DateFieldRoot.Props>;
15
+ getSeparatorProps: PropGetter<DateFieldSeparator.Props>;
16
+ setActiveSegment: react.Dispatch<react.SetStateAction<DateSegment.Segment>>;
17
+ segmentList: readonly ["day", "month", "year"];
18
+ children: null;
19
+ };
20
+ declare namespace useDateField {
21
+ interface Props {
22
+ }
23
+ }
24
+
25
+ export { useDateField };
@@ -0,0 +1 @@
1
+ "use client";import{useCallback as s,useRef as g,useState as o}from"react";import{dataAttrDev as a,mapPropsVariants as P}from"@jamsrui/utils";import{dateFieldVariants as r}from"./styles.mjs";import{DateFieldRoot as S}from"./date-field-root.mjs";const h=n=>{const[f,m]=P(n,r.variantKeys),[l,D]=o({day:"",month:"",year:""}),[i,p]=o("day"),y=g([]),[F,N]=o(null),t=r(m),c=s(e=>({...e,"data-component":a("date-field"),className:t.root({className:e.className}),"data-slot":a("root")}),[t]),d=s(e=>({...e,contentEditable:!0,suppressContentEditableWarning:!0,className:t.input({className:e.className}),"data-slot":a("input"),inputMode:"numeric",spellCheck:!1}),[t]),u=s(e=>({...e,className:t.separator({className:e.className}),"data-slot":a("separator")}),[t]);return{Component:S,segments:l,activeSegment:i,getRootProps:c,getInputProps:d,getSeparatorProps:u,setActiveSegment:p,segmentList:["day","month","year"],children:null}};export{h as useDateField};
@@ -0,0 +1,14 @@
1
+ import { ComponentProps } from 'react';
2
+ import { DateSegment } from './date-segment.mjs';
3
+ import '@jamsrui/utils';
4
+
5
+ declare const useDateSegment: (props: useDateSegment.Props) => useDateSegment.ReturnType;
6
+ declare namespace useDateSegment {
7
+ interface ReturnType extends ComponentProps<"div"> {
8
+ }
9
+ interface Props {
10
+ segment: DateSegment.Segment;
11
+ }
12
+ }
13
+
14
+ export { useDateSegment };
@@ -0,0 +1 @@
1
+ "use client";import{useCallback as o}from"react";import{useDateFieldContext as m}from"./date-field-context.mjs";const i=a=>{const{segment:n}=a,{activeSegment:p,setActiveSegment:r}=m();console.log(p);const s=o(t=>{const e=t.key;if(console.log(e),e==="ArrowLeft"){t.preventDefault();return}if(e==="ArrowRight"){t.preventDefault();return}if(e==="ArrowUp"){t.preventDefault();return}if(e==="ArrowDown"){t.preventDefault();return}if(e==="Home"){t.preventDefault();return}if(e==="End"){t.preventDefault();return}if(e==="Backspace"||e==="Delete"){t.preventDefault();return}},[]),u=o(()=>{r(n)},[n,r]);return{onKeyDown:s,onFocus:u}};export{i as useDateSegment};
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@jamsrui/date-field",
3
+ "version": "0.0.19",
4
+ "peerDependencies": {
5
+ "react": ">=19"
6
+ },
7
+ "dependencies": {
8
+ "@jamsrui/hooks": "^0.0.17",
9
+ "@jamsrui/core": "^0.0.14",
10
+ "@jamsrui/utils": "^0.0.17",
11
+ "@jamsrui/input": "^0.0.19"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.mjs"
17
+ }
18
+ },
19
+ "description": "A modern and beautiful Next.js UI components library.",
20
+ "keywords": [
21
+ "react",
22
+ "ui",
23
+ "UI components",
24
+ "Next.js",
25
+ "React",
26
+ "JamsrUI",
27
+ "jamsr-ui",
28
+ "TypeScript"
29
+ ],
30
+ "sideEffects": false,
31
+ "license": "MIT",
32
+ "author": "@jamsrworld",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/jamsrworld/jamsr-ui"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/jamsrworld/jamsr-ui/issues"
39
+ },
40
+ "homepage": "https://jamsr-ui.jamsrworld.com",
41
+ "files": [
42
+ "dist",
43
+ "README",
44
+ "README.md",
45
+ "package.json",
46
+ "LICENSE"
47
+ ]
48
+ }