@jamsrui/time-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 +40 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.mjs +1 -0
- package/dist/styles.d.mts +20 -0
- package/dist/styles.mjs +1 -0
- package/dist/time-field-config.d.mts +21 -0
- package/dist/time-field-config.mjs +1 -0
- package/dist/time-field-context.d.mts +15 -0
- package/dist/time-field-context.mjs +1 -0
- package/dist/time-field-root.d.mts +11 -0
- package/dist/time-field-root.mjs +1 -0
- package/dist/time-field-separator.d.mts +10 -0
- package/dist/time-field-separator.mjs +1 -0
- package/dist/time-field.d.mts +15 -0
- package/dist/time-field.mjs +1 -0
- package/dist/time-input.d.mts +13 -0
- package/dist/time-input.mjs +1 -0
- package/dist/time-segment.d.mts +12 -0
- package/dist/time-segment.mjs +1 -0
- package/dist/use-time-field.d.mts +25 -0
- package/dist/use-time-field.mjs +1 -0
- package/dist/use-time-segment.d.mts +14 -0
- package/dist/use-time-segment.mjs +1 -0
- package/package.json +48 -0
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
|
+
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { TimeField as TimeField$1 } from './time-field.mjs';
|
|
4
|
+
export { TimeFieldConfig, useTimeFieldConfig } from './time-field-config.mjs';
|
|
5
|
+
import { TimeFieldSeparator } from './time-field-separator.mjs';
|
|
6
|
+
import { TimeInput } from './time-input.mjs';
|
|
7
|
+
import { TimeSegment } from './time-segment.mjs';
|
|
8
|
+
export { TimeFieldSlots, TimeFieldVariants, timeFieldVariants } from './styles.mjs';
|
|
9
|
+
export { useTimeField } from './use-time-field.mjs';
|
|
10
|
+
export { useTimeSegment } from './use-time-segment.mjs';
|
|
11
|
+
import '@jamsrui/core';
|
|
12
|
+
import '@jamsrui/utils';
|
|
13
|
+
import './time-field-root.mjs';
|
|
14
|
+
|
|
15
|
+
declare const TimeField: ((props: TimeField$1.Props) => react_jsx_runtime.JSX.Element) & {
|
|
16
|
+
Input: (props: TimeInput.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
17
|
+
Segment: (props: TimeSegment.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
18
|
+
Separator: (props: TimeFieldSeparator.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { TimeField, TimeField$1 as TimeFieldRoot, TimeFieldSeparator, TimeInput, TimeSegment };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{TimeField as e}from"./time-field.mjs";import{TimeFieldConfig as o,useTimeFieldConfig as r}from"./time-field-config.mjs";import{TimeFieldSeparator as i}from"./time-field-separator.mjs";import{TimeInput as m}from"./time-input.mjs";import{TimeSegment as t}from"./time-segment.mjs";import{timeFieldVariants as p}from"./styles.mjs";import{useTimeField as l}from"./use-time-field.mjs";import{useTimeSegment as T}from"./use-time-segment.mjs";const c=Object.assign(e,{Input:m,Segment:t,Separator:i});export{c as TimeField,o as TimeFieldConfig,e as TimeFieldRoot,i as TimeFieldSeparator,m as TimeInput,t as TimeSegment,p as timeFieldVariants,l as useTimeField,r as useTimeFieldConfig,T as useTimeSegment};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as _jamsrui_utils from '@jamsrui/utils';
|
|
2
|
+
import { VariantProps } from '@jamsrui/utils';
|
|
3
|
+
|
|
4
|
+
declare const timeFieldVariants: _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 TimeFieldVariants = VariantProps<typeof timeFieldVariants>;
|
|
18
|
+
type TimeFieldSlots = keyof ReturnType<typeof timeFieldVariants>;
|
|
19
|
+
|
|
20
|
+
export { type TimeFieldSlots, type TimeFieldVariants, timeFieldVariants };
|
package/dist/styles.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{tv as t}from"@jamsrui/utils";const r=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{r as timeFieldVariants};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { WithGlobalConfig } from '@jamsrui/core';
|
|
3
|
+
import { TimeField } from './time-field.mjs';
|
|
4
|
+
import './use-time-field.mjs';
|
|
5
|
+
import 'react';
|
|
6
|
+
import '@jamsrui/utils';
|
|
7
|
+
import './time-segment.mjs';
|
|
8
|
+
import './time-field-separator.mjs';
|
|
9
|
+
import './time-field-root.mjs';
|
|
10
|
+
|
|
11
|
+
declare const useTimeFieldConfig: () => TimeFieldConfig.Props;
|
|
12
|
+
declare const TimeFieldConfig: (props: Omit<Partial<TimeFieldConfig.Props>, "children"> & {
|
|
13
|
+
merge?: boolean;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
16
|
+
declare namespace TimeFieldConfig {
|
|
17
|
+
interface Props extends WithGlobalConfig<TimeField.Props> {
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { TimeFieldConfig, useTimeFieldConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{createConfigContext as e}from"@jamsrui/utils";const[o,t]=e({displayName:"TimeFieldConfig"});export{o as TimeFieldConfig,t as useTimeFieldConfig};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { useTimeField } from './use-time-field.mjs';
|
|
3
|
+
import '@jamsrui/utils';
|
|
4
|
+
import './time-segment.mjs';
|
|
5
|
+
import './time-field-separator.mjs';
|
|
6
|
+
import './time-field-root.mjs';
|
|
7
|
+
|
|
8
|
+
declare const useTimeFieldContext: () => TimeFieldContext.Props;
|
|
9
|
+
declare const TimeFieldContext: react.Context<TimeFieldContext.Props | null>;
|
|
10
|
+
declare namespace TimeFieldContext {
|
|
11
|
+
interface Props extends ReturnType<typeof useTimeField> {
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { TimeFieldContext, useTimeFieldContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{createContext as t,use as i}from"react";const o=t(null),r=()=>{const e=i(o);if(!e)throw new Error("useTimeFieldContext must be used within TimeFieldContext");return e};export{o as TimeFieldContext,r as useTimeFieldContext};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { UIProps } from '@jamsrui/utils';
|
|
3
|
+
|
|
4
|
+
declare const TimeFieldRoot: (props: TimeFieldRoot.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
5
|
+
declare namespace TimeFieldRoot {
|
|
6
|
+
interface Props extends UIProps<"div"> {
|
|
7
|
+
as?: React.ElementType;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { TimeFieldRoot };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useRenderElement as m}from"@jamsrui/hooks";import{useTimeFieldContext as n}from"./time-field-context.mjs";const R=e=>{const{as:o="div",children:t,className:r,...s}=e,{getRootProps:i}=n();return m(o,{props:i({...s,children:t,className:r})})};export{R as TimeFieldRoot};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { UIProps } from '@jamsrui/utils';
|
|
3
|
+
|
|
4
|
+
declare const TimeFieldSeparator: (props: TimeFieldSeparator.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
5
|
+
declare namespace TimeFieldSeparator {
|
|
6
|
+
interface Props extends UIProps<"span"> {
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { TimeFieldSeparator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useRenderElement as t}from"@jamsrui/hooks";import{useTimeFieldContext as o}from"./time-field-context.mjs";const i=e=>{const{getSeparatorProps:r}=o();return t("span",{props:[r(e),{children:":"}]})};export{i as TimeFieldSeparator};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { useTimeField } from './use-time-field.mjs';
|
|
3
|
+
import 'react';
|
|
4
|
+
import '@jamsrui/utils';
|
|
5
|
+
import './time-segment.mjs';
|
|
6
|
+
import './time-field-separator.mjs';
|
|
7
|
+
import './time-field-root.mjs';
|
|
8
|
+
|
|
9
|
+
declare const TimeField: (props: TimeField.Props) => react_jsx_runtime.JSX.Element;
|
|
10
|
+
declare namespace TimeField {
|
|
11
|
+
interface Props extends useTimeField.Props {
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { TimeField };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import{mergeConfigProps as p}from"@jamsrui/utils";import{timeFieldVariants as d}from"./styles.mjs";import{useTimeFieldConfig as l}from"./time-field-config.mjs";import{TimeFieldContext as a}from"./time-field-context.mjs";import{useTimeField as c}from"./use-time-field.mjs";const x=i=>{const t=l(),r=p(d.defaultVariants,t,i),e=c(r),{Component:m,getRootProps:n,children:s}=e;return o(a,{value:e,children:o(m,{...n({}),children:s})})};export{x as TimeField};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { UIProps } from '@jamsrui/utils';
|
|
3
|
+
import { TimeSegment } from './time-segment.mjs';
|
|
4
|
+
|
|
5
|
+
declare const TimeInput: (props: TimeInput.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
6
|
+
declare namespace TimeInput {
|
|
7
|
+
interface Props extends Omit<UIProps<"div">, "children"> {
|
|
8
|
+
as?: React.ElementType;
|
|
9
|
+
children?: React.ReactNode | ((segment: TimeSegment.Segment) => React.ReactNode);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { TimeInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useRenderElement as s}from"@jamsrui/hooks";import{useTimeFieldContext as i}from"./time-field-context.mjs";const T=t=>{const{as:n="div",children:e,...r}=t,{getInputProps:o,segmentList:m}=i();return s(n,{props:[o(r),{children:typeof e=="function"?m.map(p=>e(p)):e}]})};export{T as TimeInput};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { UIProps } from '@jamsrui/utils';
|
|
3
|
+
|
|
4
|
+
declare const TimeSegment: (props: TimeSegment.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
5
|
+
declare namespace TimeSegment {
|
|
6
|
+
type Segment = "hour" | "minute" | "second" | "period";
|
|
7
|
+
interface Props extends UIProps<"div"> {
|
|
8
|
+
segment: Segment;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { TimeSegment };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useRenderElement as m}from"@jamsrui/hooks";import{useTimeFieldContext as s}from"./time-field-context.mjs";import{useTimeSegment as p}from"./use-time-segment.mjs";const g=e=>{const{segment:t,...r}=e,n=p({segment:t}),{getInputProps:o}=s();return m("div",{props:[o(r),{...n}]})};export{g as TimeSegment};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { PropGetter } from '@jamsrui/utils';
|
|
3
|
+
import { TimeSegment } from './time-segment.mjs';
|
|
4
|
+
import { TimeFieldSeparator } from './time-field-separator.mjs';
|
|
5
|
+
import { TimeFieldRoot } from './time-field-root.mjs';
|
|
6
|
+
|
|
7
|
+
type Segments = Record<TimeSegment.Segment, string>;
|
|
8
|
+
|
|
9
|
+
declare const useTimeField: (props: useTimeField.Props) => {
|
|
10
|
+
Component: (props: TimeFieldRoot.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
11
|
+
segments: Segments;
|
|
12
|
+
activeSegment: TimeSegment.Segment;
|
|
13
|
+
getRootProps: PropGetter<TimeFieldRoot.Props>;
|
|
14
|
+
getInputProps: PropGetter<TimeFieldRoot.Props>;
|
|
15
|
+
getSeparatorProps: PropGetter<TimeFieldSeparator.Props>;
|
|
16
|
+
setActiveSegment: react.Dispatch<react.SetStateAction<TimeSegment.Segment>>;
|
|
17
|
+
segmentList: readonly ["hour", "minute", "period"];
|
|
18
|
+
children: null;
|
|
19
|
+
};
|
|
20
|
+
declare namespace useTimeField {
|
|
21
|
+
interface Props {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { useTimeField };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useCallback as o,useRef as g,useState as r}from"react";import{dataAttrDev as s,mapPropsVariants as P}from"@jamsrui/utils";import{timeFieldVariants as a}from"./styles.mjs";import{TimeFieldRoot as S}from"./time-field-root.mjs";const b=m=>{const[f,n]=P(m,a.variantKeys),[i,T]=r({hour:"",minute:"",second:"",period:""}),[l,p]=r("hour"),F=g([]),[N,v]=r(null),t=a(n),c=o(e=>({...e,"data-component":s("time-field"),className:t.root({className:e.className}),"data-slot":s("root")}),[t]),u=o(e=>({...e,contentEditable:!0,suppressContentEditableWarning:!0,className:t.input({className:e.className}),"data-slot":s("input"),inputMode:"numeric",spellCheck:!1}),[t]),d=o(e=>({...e,className:t.separator({className:e.className}),"data-slot":s("separator")}),[t]);return{Component:S,segments:i,activeSegment:l,getRootProps:c,getInputProps:u,getSeparatorProps:d,setActiveSegment:p,segmentList:["hour","minute","period"],children:null}};export{b as useTimeField};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { TimeSegment } from './time-segment.mjs';
|
|
3
|
+
import '@jamsrui/utils';
|
|
4
|
+
|
|
5
|
+
declare const useTimeSegment: (props: useTimeSegment.Props) => useTimeSegment.ReturnType;
|
|
6
|
+
declare namespace useTimeSegment {
|
|
7
|
+
interface ReturnType extends ComponentProps<"div"> {
|
|
8
|
+
}
|
|
9
|
+
interface Props {
|
|
10
|
+
segment: TimeSegment.Segment;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { useTimeSegment };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useCallback as o}from"react";import{useTimeFieldContext as u}from"./time-field-context.mjs";const f=m=>{const{segment:n}=m,{activeSegment:i,setActiveSegment:r}=u();console.log(i);const p=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}},[]),s=o(()=>{r(n)},[n,r]);return{onKeyDown:p,onFocus:s}};export{f as useTimeSegment};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jamsrui/time-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
|
+
}
|