@refraktor/dates 0.0.1 → 0.0.3
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/.turbo/turbo-build.log +1 -1
- package/build/components/date-input/date-input.d.ts.map +1 -1
- package/build/components/date-input/date-input.js +5 -3
- package/build/components/index.d.ts +2 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +2 -0
- package/build/components/month-input/month-input.d.ts.map +1 -1
- package/build/components/month-input/month-input.js +5 -3
- package/build/components/time-input/index.d.ts +3 -0
- package/build/components/time-input/index.d.ts.map +1 -0
- package/build/components/time-input/index.js +1 -0
- package/build/components/time-input/time-input.d.ts +4 -0
- package/build/components/time-input/time-input.d.ts.map +1 -0
- package/build/components/time-input/time-input.js +207 -0
- package/build/components/time-input/time-input.types.d.ts +99 -0
- package/build/components/time-input/time-input.types.d.ts.map +1 -0
- package/build/components/time-input/time-input.types.js +1 -0
- package/build/components/time-picker/index.d.ts +3 -0
- package/build/components/time-picker/index.d.ts.map +1 -0
- package/build/components/time-picker/index.js +1 -0
- package/build/components/time-picker/time-picker.d.ts +4 -0
- package/build/components/time-picker/time-picker.d.ts.map +1 -0
- package/build/components/time-picker/time-picker.js +405 -0
- package/build/components/time-picker/time-picker.types.d.ts +79 -0
- package/build/components/time-picker/time-picker.types.d.ts.map +1 -0
- package/build/components/time-picker/time-picker.types.js +1 -0
- package/build/components/year-input/year-input.d.ts.map +1 -1
- package/build/components/year-input/year-input.js +5 -3
- package/build/style.css +1 -1
- package/package.json +3 -3
- package/src/components/date-input/date-input.tsx +5 -2
- package/src/components/index.ts +2 -0
- package/src/components/month-input/month-input.tsx +5 -2
- package/src/components/time-input/index.ts +23 -0
- package/src/components/time-input/time-input.tsx +453 -0
- package/src/components/time-input/time-input.types.ts +163 -0
- package/src/components/time-picker/index.ts +19 -0
- package/src/components/time-picker/time-picker.tsx +737 -0
- package/src/components/time-picker/time-picker.types.ts +135 -0
- package/src/components/year-input/year-input.tsx +5 -2
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import {
|
|
3
|
+
RefraktorRadius,
|
|
4
|
+
RefraktorSize,
|
|
5
|
+
createClassNamesConfig,
|
|
6
|
+
createComponentConfig,
|
|
7
|
+
FactoryPayload
|
|
8
|
+
} from "@refraktor/core";
|
|
9
|
+
|
|
10
|
+
export type TimePickerValue = string;
|
|
11
|
+
export type TimePickerMode = "12h" | "24h";
|
|
12
|
+
export type TimePickerPeriod = "am" | "pm";
|
|
13
|
+
export type TimePickerSize = RefraktorSize;
|
|
14
|
+
export type TimePickerRadius = RefraktorRadius;
|
|
15
|
+
|
|
16
|
+
export type TimePickerOnChange = (value: TimePickerValue) => void;
|
|
17
|
+
|
|
18
|
+
export type TimePickerGetHourLabel = (
|
|
19
|
+
hour: number,
|
|
20
|
+
mode: TimePickerMode
|
|
21
|
+
) => ReactNode;
|
|
22
|
+
|
|
23
|
+
export type TimePickerGetMinuteLabel = (minute: number) => ReactNode;
|
|
24
|
+
|
|
25
|
+
export type TimePickerGetSecondLabel = (second: number) => ReactNode;
|
|
26
|
+
|
|
27
|
+
export type TimePickerGetPeriodLabel = (period: TimePickerPeriod) => ReactNode;
|
|
28
|
+
|
|
29
|
+
export type TimePickerGetHourAriaLabel = (
|
|
30
|
+
hour: number,
|
|
31
|
+
mode: TimePickerMode,
|
|
32
|
+
selected: boolean
|
|
33
|
+
) => string;
|
|
34
|
+
|
|
35
|
+
export type TimePickerGetMinuteAriaLabel = (
|
|
36
|
+
minute: number,
|
|
37
|
+
selected: boolean
|
|
38
|
+
) => string;
|
|
39
|
+
|
|
40
|
+
export type TimePickerGetSecondAriaLabel = (
|
|
41
|
+
second: number,
|
|
42
|
+
selected: boolean
|
|
43
|
+
) => string;
|
|
44
|
+
|
|
45
|
+
export type TimePickerGetPeriodAriaLabel = (
|
|
46
|
+
period: TimePickerPeriod,
|
|
47
|
+
selected: boolean
|
|
48
|
+
) => string;
|
|
49
|
+
|
|
50
|
+
export type TimePickerClassNames = {
|
|
51
|
+
root?: string;
|
|
52
|
+
grid?: string;
|
|
53
|
+
section?: string;
|
|
54
|
+
sectionLabel?: string;
|
|
55
|
+
list?: string;
|
|
56
|
+
option?: string;
|
|
57
|
+
optionActive?: string;
|
|
58
|
+
optionDisabled?: string;
|
|
59
|
+
hourSection?: string;
|
|
60
|
+
minuteSection?: string;
|
|
61
|
+
secondSection?: string;
|
|
62
|
+
periodSection?: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export interface TimePickerProps
|
|
66
|
+
extends Omit<
|
|
67
|
+
ComponentPropsWithoutRef<"div">,
|
|
68
|
+
"onChange" | "value" | "defaultValue"
|
|
69
|
+
> {
|
|
70
|
+
/** Active time (controlled), accepts `H:mm:ss` or `HH:mm:ss` (24h). */
|
|
71
|
+
value?: TimePickerValue;
|
|
72
|
+
|
|
73
|
+
/** Initial active time (uncontrolled), accepts `H:mm:ss` or `HH:mm:ss` (24h). */
|
|
74
|
+
defaultValue?: TimePickerValue;
|
|
75
|
+
|
|
76
|
+
/** Callback called when active time changes in normalized `HH:mm:ss` format (24h). */
|
|
77
|
+
onChange?: TimePickerOnChange;
|
|
78
|
+
|
|
79
|
+
/** Lower selectable bound for time-of-day, accepts `H:mm:ss` or `HH:mm:ss` (24h). */
|
|
80
|
+
minTime?: TimePickerValue;
|
|
81
|
+
|
|
82
|
+
/** Upper selectable bound for time-of-day, accepts `H:mm:ss` or `HH:mm:ss` (24h). */
|
|
83
|
+
maxTime?: TimePickerValue;
|
|
84
|
+
|
|
85
|
+
/** Time display mode @default `24h` */
|
|
86
|
+
mode?: TimePickerMode;
|
|
87
|
+
|
|
88
|
+
/** Whether all controls are disabled @default `false` */
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
|
|
91
|
+
/** Component size @default `md` */
|
|
92
|
+
size?: TimePickerSize;
|
|
93
|
+
|
|
94
|
+
/** Border radius @default `default` */
|
|
95
|
+
radius?: TimePickerRadius;
|
|
96
|
+
|
|
97
|
+
/** Custom hour label renderer. */
|
|
98
|
+
getHourLabel?: TimePickerGetHourLabel;
|
|
99
|
+
|
|
100
|
+
/** Custom minute label renderer. */
|
|
101
|
+
getMinuteLabel?: TimePickerGetMinuteLabel;
|
|
102
|
+
|
|
103
|
+
/** Custom second label renderer. */
|
|
104
|
+
getSecondLabel?: TimePickerGetSecondLabel;
|
|
105
|
+
|
|
106
|
+
/** Custom AM/PM label renderer in 12h mode. */
|
|
107
|
+
getPeriodLabel?: TimePickerGetPeriodLabel;
|
|
108
|
+
|
|
109
|
+
/** Custom aria-label generator for hour options. */
|
|
110
|
+
getHourAriaLabel?: TimePickerGetHourAriaLabel;
|
|
111
|
+
|
|
112
|
+
/** Custom aria-label generator for minute options. */
|
|
113
|
+
getMinuteAriaLabel?: TimePickerGetMinuteAriaLabel;
|
|
114
|
+
|
|
115
|
+
/** Custom aria-label generator for second options. */
|
|
116
|
+
getSecondAriaLabel?: TimePickerGetSecondAriaLabel;
|
|
117
|
+
|
|
118
|
+
/** Custom aria-label generator for period options. */
|
|
119
|
+
getPeriodAriaLabel?: TimePickerGetPeriodAriaLabel;
|
|
120
|
+
|
|
121
|
+
/** Used for editing root class name. */
|
|
122
|
+
className?: string;
|
|
123
|
+
|
|
124
|
+
/** Used for styling different parts of the component. */
|
|
125
|
+
classNames?: TimePickerClassNames;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface TimePickerFactoryPayload extends FactoryPayload {
|
|
129
|
+
props: TimePickerProps;
|
|
130
|
+
ref: HTMLDivElement;
|
|
131
|
+
compound: {
|
|
132
|
+
configure: ReturnType<typeof createComponentConfig<TimePickerProps>>;
|
|
133
|
+
classNames: ReturnType<typeof createClassNamesConfig<TimePickerClassNames>>;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
@@ -180,7 +180,8 @@ const YearInput = factory<YearInputFactoryPayload>((_props, ref) => {
|
|
|
180
180
|
open: isOpen,
|
|
181
181
|
onOpenChange: handleOpenChange,
|
|
182
182
|
middleware,
|
|
183
|
-
whileElementsMounted: autoUpdate
|
|
183
|
+
whileElementsMounted: autoUpdate,
|
|
184
|
+
strategy: "fixed"
|
|
184
185
|
});
|
|
185
186
|
|
|
186
187
|
const focus = useFocus(floating.context, {
|
|
@@ -267,13 +268,15 @@ const YearInput = factory<YearInputFactoryPayload>((_props, ref) => {
|
|
|
267
268
|
transition="fade"
|
|
268
269
|
duration={150}
|
|
269
270
|
mounted={isOpen}
|
|
271
|
+
style={{ position: "relative", zIndex: 1000 }}
|
|
270
272
|
{...transitionProps}
|
|
271
273
|
>
|
|
272
274
|
<div
|
|
273
275
|
ref={floating.refs.setFloating}
|
|
274
276
|
id={dropdownId}
|
|
275
277
|
style={{
|
|
276
|
-
...floating.floatingStyles
|
|
278
|
+
...floating.floatingStyles,
|
|
279
|
+
zIndex: 1000
|
|
277
280
|
}}
|
|
278
281
|
className={cx(
|
|
279
282
|
"w-60 z-50 border border-[var(--refraktor-border)] bg-[var(--refraktor-bg)] p-2 text-[var(--refraktor-text)] shadow-md",
|